<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" > <!--instantiate a Class (attribute injection the first way) - <BeanID= "Personone"class= "Java_spring.modle.Person"> < Propertyname= "UserId"value= "1"></ Property> < Propertyname= "UserName"value= "Zhang San Feng"></ Property> < Propertyname= "Userage"value= "+"></ Property> </Bean> <!--instantiate a Class (attribute injection the second way) - <BeanID= "Persontwo"class= "Java_spring.modle.Person"> < Propertyname= "UserId"> <value>2</value> </ Property> <!--How to assign special characters - < Propertyname= "UserName"> <value><! [Cdata[< Zhang Mowgli >]]></value> </ Property> < Propertyname= "Userage"> <value>30</value> </ Property> </Bean> <!--Instantiate Class (constructor injection) index specifies the number of parameters assigned to the constructor, which can be omitted in order to assign values - <!--constructor Injection By default it is also possible to add the Type property by typing the constructor-arg tag and assigning the same type Order - <BeanID= "Personthree"class= "Java_spring.modle.Person"> <Constructor-argvalue= "3"Index= "0"></Constructor-arg> <Constructor-argvalue= "+"Index= "2"></Constructor-arg> <Constructor-argvalue= "Yellow Pharmacist"Index= "1"></Constructor-arg> </Bean></Beans>
Spring JavaBean method of injection of property values (attribute injection, special character injection <![ cdata[value]]> with special characters, constructor injection)