spring2.5jar包和配置文件总结
2012-03-20 19:14
423 查看
1.基本组件管理需要的jar包
commons-logging.jar,spring.jar
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:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
2.Aopjar包和 xml配置
jar:
aspectjweaver.jar aspectjrt.jar cglib-nodep-2.1_3.jar
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:context="http://www.springframework.org/schema/context" 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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
3. 完整配置
<?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: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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<!-- 注解方式-->
<!--
<context:annotation-config/>
<bean id="personDao" class="com.westsoft.daoimpl.PersonDaoBean"></bean>
<bean id="personServiec" class="com.westsoft.serviceimpl.PersonServiceBean">
<property name="personDao" ref="personDao"/>
</bean>
-->
<!-- 注解方式自动扫描包方式 -->
<context:component-scan base-package="com.westsoft"/>
<!-- Aop支持 -->
<aop:aspectj-autoproxy/>
<!-- AOP可以用注解的方式也可以用配置XML的方式 -->
</beans>
commons-logging.jar,spring.jar
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:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
2.Aopjar包和 xml配置
jar:
aspectjweaver.jar aspectjrt.jar cglib-nodep-2.1_3.jar
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:context="http://www.springframework.org/schema/context" 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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
3. 完整配置
<?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: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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<!-- 注解方式-->
<!--
<context:annotation-config/>
<bean id="personDao" class="com.westsoft.daoimpl.PersonDaoBean"></bean>
<bean id="personServiec" class="com.westsoft.serviceimpl.PersonServiceBean">
<property name="personDao" ref="personDao"/>
</bean>
-->
<!-- 注解方式自动扫描包方式 -->
<context:component-scan base-package="com.westsoft"/>
<!-- Aop支持 -->
<aop:aspectj-autoproxy/>
<!-- AOP可以用注解的方式也可以用配置XML的方式 -->
</beans>
相关文章推荐
- Spring学习总结(3)——Spring配置文件详解
- spring的配置文件总结
- Spring配置文件总结
- Spring配置文件总结
- MyBatis整合到Spring 配置文件总结与分析
- spring配置文件详解【总结】
- Spring学习总结(3)——Spring配置文件详解
- Spring配置文件总结
- 4.减少spring的配置文件:总结
- Spring学习总结(3)——Spring配置文件详解
- spring配置文件application.xml中的事务总结
- Spring 配置文件总结
- spring 配置文件总结
- Spring配置文件总结
- spring读取配置文件初始化容器操作总结
- Spring配置文件总结
- spring配置文件bean标签 name属性取值语法问题,(新手问题多)--小问题总结都在这里
- 关于spring的配置文件总结
- spring读取配置文件初始化容器操作总结
- spring读取配置文件初始化容器操作总结