`

Spring配置文件(xml)中的xmlns解析

 
阅读更多

http://blog.csdn.net/javabenface/article/details/7441923

 

 

以前一直没注意spring对xml的解析过程,
特别是xml文件头上的一堆xmlns:

这些命名空间中是怎么解析的,
大概可以分为下面这个步骤:
1. 解析XML, 找到所有的 命名空间 如: http://www.springframework.org/schema/context
2. 在Classpath中查找所有的 spring.handlers 并解析其中配置的 命名空间 与 对应的处理类, 如:

http\://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler

3. 根据查找到的处理Handler去解析配置文件中相应的结点.

而命名空间对应的xsd文件, 则是在 spring.schemas 中指定的, 如:

 

http\://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd
http\://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd
http\://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd
http\://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd
分享到:
评论

相关推荐

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

    xml中的xmlns:、xmlns:xsi和xsi:schemaLocation。

    Spring 配置文件XML头部文件模板实例详解

    普通spring配置文件模板: <?xml version=1.0 encoding=UTF-8 ?> <beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns=http://www.springframework.org/schema/beans xsi:schemaLocation...

    springmvc-config.xml

    这是一个springmvc-config.xml文件,<?xml version="1.0" encoding="UTF-8"?> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:...

    Maven的pom.xml配置文件详细配置说明

    Maven的pom.xml配置文件详细配置说明 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=...

    jquery解析带名称空间的xml

    jquery.xmlns-1.7.0.js 是根据jquery.xmlns.js改写的适用于各种版本的jquery解析带命名空间的XML数据,里面附有实例代码,如果使用中有遇到问题,可以反馈,我会进一步改进。

    Spring XML 配置扩展机制

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemaLocation=...

    oracle 解析xml

    oracle 解析 xml 简单直接 xmldom

    spring applicationContext 配置文件

    <description>Spring公共配置文件 <!-- mes 的數據庫 --> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> ...

    spring声明式事务配置

    <?xml version="1.0" encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans" xmlns:xsi=...springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

    解决xmlns设置后继承到子类问题

    解决xml命名xmlns自动继承到子类问题java代码及jar包

    spring aop 实现源代码--xml and annotation(带lib包)

    假如有一天我们的应用程序不需要再业务代码执行前记录日志了,只需要修改XML文件中的定义,而不用更改AdviceDemo的代码: xml 代码 1. <bean id="messageSender" class="com.savage.aop.HttpMessageSender">bean> ...

    spring框架配置bean的高级属性

    关键就在于配置文件,下面看一个样例app.xml: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...

    SpringMVC配置文件最全约束

    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=...

    dubbo.xsd文件

    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:tool="http://www.springframework.org/schema/tool" targetNamespace=...

    dom4j 读取带有命名空间的xml文件

    NULL 博文链接:https://qiaokeli.iteye.com/blog/1790138

    springweb3.0MVC注解(附实例)

    web.xml 中定义了一个名为 annomvc 的 Spring MVC 模块,按照 Spring MVC 的契约,需要在 WEB-INF/annomvc-servlet.xml 配置文件中定义 Spring MVC 模块的具体配置。annomvc-servlet.xml 的配置内容如下所示: <?xml...

    配置文件pom.xml

    Windows下Eclipse配置Appium环境资料 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...

    asp.net_spring_nhibernate_oracle

    提示二:Spring.cfg.xml中【objects xmlns="http://www.springframework.net" xmlns:db ="http://www.springframework.net/database" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" xmlns...

    spring2.0声明式事务

    iii. 修改spring配置文件,增加常用命名空间 <xml? Version=”1.0” encoding=”utf-8”?> <beans xmlns=”http://www.springframework.org/schema/beans” xmlns:xsi=”http://w3.org/2001/XMLSchema-instance” ...

    Spring AOP配置源码

    @Component("userService")等价于在spring配置文件中定义一个<bean id="userService"/> @Resource(name="userDAO")将userDA注入进来 写一个拦截器的类 package com.spring.aop; import org.springframework....

Global site tag (gtag.js) - Google Analytics