然后修改一下配置文件
代码
1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4xmlns:aop="http://www.springframework.org/schema/aop"
5xsi:schemaLocation="
6 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
7 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
8
9<aop:aspectj-autoproxy />
10
11<bean id="a" class="com.longthsoft.learn.spring.models.A" />
12<bean id="b" class="com.longthsoft.learn.spring.models.B" />
13
14<bean id="simpleAspect" class="com.longthsoft.learn.spring.SimpleAspect" />
15 </beans>
16
OK, 运行一下:
Hello, I’m a
Merry Christmas
Hi, I’m b
Merry Christmas
上一页 [1] [2] [3]
责任编辑:小草