Spring注解

来源:互联网 发布:idm for mac 破解 编辑:程序博客网 时间:2024/06/06 07:38

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:p="http://www.springframework.org/schema/p"    xmlns:context="http://www.springframework.org/schema/context"    xmlns:aop="http://www.springframework.org/schema/aop"    xmlns:tx="http://www.springframework.org/schema/tx"    xsi:schemaLocation="http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd    http://www.springframework.org/schema/context    http://www.springframework.org/schema/context/spring-context-3.0.xsd    http://www.springframework.org/schema/tx    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd    http://www.springframework.org/schema/aop    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

1.xmlns=http://www.springframework.org/schema/beans表示是spring beans的xml配置文件

2.xmlns:xsi;xmlns:context;xmlns:aop;xmlns:tx;声明可以使用标准的xml标签(xsi);也可以使用context;aop;tx等声明后的标签库的标签,即声明的xmlns:后的内容可以作为标签规则出现在xml文件中,没有包含在内的使用时会报错(作为一种严格的标记语言的特性)。

3.xsi-schemaLocation这是语法规则契约(xmlns也是;而xmlns:xsi只是声明标签的规则),=等号后面的内容就是引入的具体的标签库和对应的要在文本中使用的标签库具体版本规则的地址。

4.由于在xsi-schemaLocation中定义的是标签的属性等相关信息,xmlns:p中由于p命名空间的引入是为了简化属性property的书写格式,而p的属性是可变的,所以没有在xsi-schemaLocation中定义。

注意:在xsi-schemaLocation中最后一个http:.....与双引号”之间要有一个空格,否则会找不到地址报错。



0 0