一、IOC
4核心+1依赖
4核心:(路径:spring-framework-4.2.4.RELEASE\libs)
spring-beans-4.2.4.RELEASE.jar,spring-context-4.2.4.RELEASE.jar
spring-core-4.2.4.RELEASE.jar,spring-expression-4.2.4.RELEASE.jar
1依赖:(spring-framework-3.0.2.RELEASE-dependencies\org.apache.commons\
com.springsource.org.apache.commons.logging\1.1.1)
com.springsource.org.apache.commons.logging-1.1.1.jar
二、Spring,bean装配基于注解
1、需要spring-context-4.2.4.RELEASE.jar,spring-aop-4.2.4.RELEASE.jar的jar包
2、以下代码内容在 路径:spring-framework-4.2.4.RELEASE\docs\spring-framework-reference\html下的最后一个html中40.2.8 the context schema的标题下,需要把红色部分复制到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.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- bean definitions here -->
</beans> |
( 这里我用的是spring4的jar,所以在编写注解的时候需要导入aop的jar包,我之前测试了很久都没有测试出来,总是xml报 错,在我导入了spring-aop-4.2.4.RELEASE.jar之后就可以正常运行了。如果是spring3不需要导入了)
三、Spring jdk,cglib字节码增强
需要导入jar包spring-core-4.2.4.RELEASE.jar
四、Spring aop编程
1、需要导入spring-aop-4.2.4.RELEASE.jar
和一个依赖com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar
(依赖路径为:spring-framework-3.0.2.RELEASE-dependencies\org.aspectj\
com.springsource.org.aspectj.weaver\1.6.8.RELEASE)
2、需要将以下的代码中红色的复制到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:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <!-- bean definitions here --> </beans>
|