Day10 - p namespace

I. Introduction

To simplify the configuration xml file, an increasing number of XML documents using attributes instead of child elements of configuration information. spring introduced a namespace syntax, by <Bean>the member attribute configuration variables Bean object.

II. P-namespace configuration information

First click on the lower left corner xml file "Namespaces", hook on the p-http: //springframework.org/schema/p, as shown below:
Here Insert Picture Description
applicationContext.xml

<bean id="book" class="com.atguigu.spring.bean.Book">
         <property name="book_id" value="1001"></property>
         <property name="title" >
             <value><![CDATA[<<Thinking in Java>>]]></value>
         </property>
    </bean>
   
   
    <bean id="person1" class="com.atguigu.spring.bean.Person"
        p:name="老李" p:book-ref="book">
    </bean>
Published 176 original articles · won praise 16 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_40634846/article/details/104102243