首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

Spring配备文的命名空间

2012-09-22 
Spring配置文的命名空间?xml version1.0 encodingUTF-8?beans xmlnshttp://www.springframewor

Spring配置文的命名空间

<?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:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"><aop:aspectj-autoproxy/><!--使用注解的方式AOP注入--><bean style="vertical-align: baseline;" width="232" src="/img/2012/09/14/1337221104.jpg" height="379">

?

打开spring.schemas文件,可以查看到对应命名空间内容,然后输入到配置文件中(这里要保证版本对应)

?

http\://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsdhttp\://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsdhttp\://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-2.5.xsd

?

在配置文件中的xsi:schemaLocation标签的内容有顺序,例如

?

?

http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.5.xsd

?

必须保证http://www.springframework.org/schema/aop

在?http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
前面,否则不会正确的解析

热点排行