`
mytherf
  • 浏览: 20503 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

Spring p-namespace http://www.springframework.org/schema/p

阅读更多

 

The following two XML snippets boil down to the same thing in the end: the first is using the standard XML

format whereas the second example is using the p-namespace.

 

<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-2.5.xsd">
<bean name="classic" class="com.example.ExampleBean">
<property name="email" value="foo@bar.com/>
</bean>
<bean name="p-namespace" class="com.example.ExampleBean"
p:email="foo@bar.com"/>
</beans>

 

This next example includes two more bean definitions that both have a reference to another bean:

<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-2.5.xsd">
<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>
 

 

 

分享到:
评论

相关推荐

    dubbo.xsd文件

    &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" ... &lt;xsd:import namespace="http://www.springframework.org/schema/tool"/&gt;

    xml中的xmlns:、xmlns:xsi和xsi:schemaLocation.doc

    "XML中的xmlns、xmlns:xsi和xsi:...在上面的代码中,xmlns="http://maven.apache.org/POM/4.0.0"定义了命名空间,xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"定义了XML schema实例,xsi:schemaLocation=...

    spring、springmvc、mybatis的mapper三个文件的根节点标签

    &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans ...

    dubbo.xsd阿里巴巴开源xsd文件

    &lt;xsd:import namespace="http://www.springframework.org/schema/beans"/&gt; &lt;xsd:import namespace="http://www.springframework.org/schema/tool"/&gt; &lt;xsd:annotation&gt; &lt;xsd:documentation&gt;&lt;![CDATA[ ...

    SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)

    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ...

    springmvc+mybatis+oracle

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt; &lt;!-- 设置字符编码过滤器 --&gt; ...

    java8+tomcat8+struts2.5+spring4.3+hibernate5.2框架搭建详细过程

    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ...

    spring xml扩展

    &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans ...

    [新手-图文]整合ssm框架-从mybatis到spring-mybatis再到ssm-sping-mybatis-spingmvc

    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;!-- 扫描DAO接口 --&gt; &lt;bean class="org.mybatis.spring.mapper....

    springmvc和mybatis整合

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx=...

    扩展Spring schema样例代码 maven

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myapp="http://example.com/schema/myapp" xsi:schemaLocation="http://www.springframework.org/schema/beans ...

    spring webflow升级-从1.0 到 2.0

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webflow="http://www.springframework.org/schema/webflow-config" xsi:schemaLocation=" http://www.springframework.org/schema/beans ...

    spring mvc架构搭建,实现简单的查询用户查询功能

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=...

    eclipse搭建SSH框架详解

    &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation=...

    spring mvc 项目错误,和一些配置

    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;!-- 其他配置 --&gt; &lt;/beans&gt; ``` - **spring-mvc.xml文件** ```xml ...

    springAOP demo 带错误解决文档

    在搭建spring项目时通常需要这些jar包 ...org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace ...

    spring3.2+strut2+hibernate4

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context=...

    spring+hibernate+struts2 +mybatis整合笔记

    http://www.springframework.org/schema/context/spring-context.xsd"&gt; &lt;context:component-scan base-package="com.example"/&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy...

    maven搭建ssm

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=...

Global site tag (gtag.js) - Google Analytics