我试图在没有任何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.