
P Name Space
The P Name Space is used for replacing
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- stardard XML format -->
<bean name="john-classic" class="com.knicolle.Person">
<property name="name" value="John Doe"/>
<property name="spouse" ref="jane"/>
</bean>
<!-- p name space format -->
<bean name="john-modern"
class="com.knicolle.Person"
p:name="John Doe"
p:spouse-ref="jane"/>
</beans>
C Name Space
The P Name Space is used for replacing
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="http://www.springframework.org/schema/c"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="bar" class="x.y.Bar"/>
<bean id="baz" class="x.y.Baz"/>
<!-- stardard XML format -->
<bean id="foo" class="x.y.Foo">
<constructor-arg name="bar" ref="bar"/>
<constructor-arg name="baz" ref="baz"/>
<constructor-arg name="email" value="[email protected]"/>
</bean>
<!-- c name space format -->
<bean id="foo" class="x.y.Foo" c:bar-ref="bar" c:baz-ref="baz" c:email="[email protected]"/>
<!-- param index of c name space format -->
<bean id="foo" class="x.y.Foo" c:_0-ref="bar" c:_1-ref="baz" c:_2="[email protected]"/>
</beans>




近期评论