1.准备了一个实现接口的bean,还有一个事务的碎片化方法的类;
2. 把这两个类配置到spring容器中;
3.配置springAop
1)引入aop命名空间
2)配置AOP,格式如下:
<aop:config>
<aop:point-cut expression="" id="sample"/>
<aop:aspect ref="">
<aop:before method="" pointcut-ref="sample">
<aop:after-returning method="" pointcut-ref="sample">
<aop:afte-throwing method="" pointcut-ref="sample">
</aop:aspect>
</aop:config>
[1]aop:config AOP配置
[2]aop:point-cut AOP切入点
[3]aop:aspect AOP切面配置
[4]aop:* 都是一个AOP切面
4.在接口文件中配置一个业务逻辑对象的接口,DI注入。并在test方法中直接调用该接口的具体业务逻辑