http://blog.csdn.net/javabenface/article/details/7441923
以前一直没注意spring对xml的解析过程,
特别是xml文件头上的一堆xmlns:
1 |
<? xml version = "1.0" encoding = "UTF-8" ?>
|
3 |
</ beans >
|
这些命名空间中是怎么解析的,
大概可以分为下面这个步骤:
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。
普通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文件,<?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配置文件详细配置说明 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=...
jquery.xmlns-1.7.0.js 是根据jquery.xmlns.js改写的适用于各种版本的jquery解析带命名空间的XML数据,里面附有实例代码,如果使用中有遇到问题,可以反馈,我会进一步改进。
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemaLocation=...
oracle 解析 xml 简单直接 xmldom
<description>Spring公共配置文件 <!-- mes 的數據庫 --> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> ...
<?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">
解决xml命名xmlns自动继承到子类问题java代码及jar包
假如有一天我们的应用程序不需要再业务代码执行前记录日志了,只需要修改XML文件中的定义,而不用更改AdviceDemo的代码: xml 代码 1. <bean id="messageSender" class="com.savage.aop.HttpMessageSender">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" ...
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=...
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=...
NULL 博文链接:https://qiaokeli.iteye.com/blog/1790138
web.xml 中定义了一个名为 annomvc 的 Spring MVC 模块,按照 Spring MVC 的契约,需要在 WEB-INF/annomvc-servlet.xml 配置文件中定义 Spring MVC 模块的具体配置。annomvc-servlet.xml 的配置内容如下所示: <?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:...
提示二: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...
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” ...
@Component("userService")等价于在spring配置文件中定义一个<bean id="userService"/> @Resource(name="userDAO")将userDA注入进来 写一个拦截器的类 package com.spring.aop; import org.springframework....