spring beans 标签
2011-12-12 09:35
190 查看
我经常忘记spring beans 标签的其中的一些写法:
我们一般最简单的写法是
<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
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
但是我经常配置事务的用了aop和tx标签所以我要加
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
和把schemaLocation改为
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/beans/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/beans/spring-tx-3.0.xsd"
这样我们就可以使用tx和aop标签了。
现在3.0经常使用注解式的编程方法要用到context这个标签
所以要加 xmlns:context="http://www.springframework.org/schema/context"
和在schemaLocation中加入
http://www.springframework.org/schema/context http://www.springframework.org/schema/beans/spring-context-3.0.xsd
这样我就可以使用
<context:annotation-config>这类的标签了
我们一般最简单的写法是
<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
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
但是我经常配置事务的用了aop和tx标签所以我要加
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
和把schemaLocation改为
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/beans/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/beans/spring-tx-3.0.xsd"
这样我们就可以使用tx和aop标签了。
现在3.0经常使用注解式的编程方法要用到context这个标签
所以要加 xmlns:context="http://www.springframework.org/schema/context"
和在schemaLocation中加入
http://www.springframework.org/schema/context http://www.springframework.org/schema/beans/spring-context-3.0.xsd
这样我就可以使用
<context:annotation-config>这类的标签了
相关文章推荐
- spring 之 import标签、alias标签、beans标签 解析
- Spring学习笔记(十七):spring配置文件详解以及beans:beans标签
- spring beans标签的default-lazy-init属性
- 4.3 spring-嵌入式beans标签的解析
- Spring配置文件中的<beans>标签
- spring源码附录(8)import、beans标签的解析
- spring源码(5)父子beans标签之间的属性关系
- spring配置文件详解以及beans标签
- Spring的beans标签下可以有其他标签
- Spring中beans标签定义
- 在 Spring 配置文件中写 Dubbo 标签报错 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException
- org.springframework.beans.factory.BeanDefinitionStoreException
- Spring学习笔记 关于spring 2.x中dependency-check标签与Spring3中的实现方式
- Failed to read schema document 'http://www.springframework.org/schema/beans/spring- beans-3.2.xsd'
- org.springframework.beans.factory.BeanCreationException 解决办法
- hibernate与Spring整合时出现错误org.springframework.beans.factory.BeanCreationException: Error creating bean
- 错误 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException 解决办法
- spring常用的标签@Repository,@controller,@service
- Spring配置文件标签报错:The prefix "XXX" for element "XXX:XXX" is not bound. .
- spring扩展自定义标签的方法