Spring 命名空間 p

<?xml version = 1.0 encoding=UTF-8>

<beans 
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.springframework.org/2001/XMLSchema-instance"
    
    xmlns:p="http://www.springframework.org/schema/p"

    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframe.org/schema/beans/spring-beans.xsd">
    
    <bean name="classic" class="com.example.ExampleBean">
      <property name="email" value="[email protected]"/>
  </bean>

  <bean name="p-namespace" class="com.example.ExampleBean"
        p:email="[email protected]"/>



    <bean name="john-classic" class="com.example.Person">
      <property name="name" value="John Doe"/>
      <property name="spouse" ref="jane"/>
  </bean>

  <bean name="john-modern"
      class="com.example.Person"
      p:name="John Doe"
      p:spouse-ref="jane"/>

  <bean name="jane" class="com.example.Person">
      <property name="name" value="Jane Doe"/>
  </bean>
</beans>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章