1、AspectJ方式配置
a) 导入jar包
com.springsource.net.sf.cglib-2.2.0.jar 、com.springsource.org.aopalliance-1.0.0.jar、
com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar、
commons-logging-1.1.3.jar spring-aop-4.0.0.RELEASE.jar、
spring-aspects-4.0.0.RELEASE.jar、 spring-beans-4.0.0.RELEASE.jar
spring-context-4.0.0.RELEASE.jar 、spring-core-4.0.0.RELEASE.jar
spring-expression-4.0.0.RELEASE.jar
b) 编写目标类和接口
c) 编写切面类
<?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-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop |