Spring JavaBean method of injection of property values (attribute injection, special character injection <![ cdata[value]]> with special characters, constructor injection)

Source: Internet
Author: User
Tags cdata

<?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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.