小编CKu*_*uck的帖子

没有XML的Spring AOP

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

java xml aop spring

6
推荐指数
1
解决办法
6433
查看次数

标签 统计

aop ×1

java ×1

spring ×1

xml ×1