CKu*_*uck 6 java xml aop spring
我试图在没有任何XML的情况下设置Spring AOP,并且想知道如何以这种方式启用自动代理.
定义一个AutoProxyCreator-bean有效,但是没有更简单的方法吗?
这就是我的@Configuration的样子:
@Configuration
public class Context {
@Bean
public AnnotationAwareAspectJAutoProxyCreator annotationAwareAspectJAutoProxyCreator() {
return new AnnotationAwareAspectJAutoProxyCreator();
};
...
}
Run Code Online (Sandbox Code Playgroud)
扫描所有其他bean AnnotationConfigApplicationContext.
Spring 3.0.x没有提供简单的方法来替换XML命名空间扩展(例如<aop:aspectj-autoproxy>)@Configuration.
即将推出的Spring 3.1将支持用于此目的的特殊注释,例如@EnableAspectJAutoProxy.
| 归档时间: |
|
| 查看次数: |
6433 次 |
| 最近记录: |