ITeye博客

Spring配置项之<aop:aspectj-autoproxy />

kld208 · 2012-08-15 15:35 · Spring · 开源软件 · Spring · <aop:aspectj-autoproxy /> · Markdown

通过配置织入@Aspectj切面

虽然可以通过编程的方式织入切面,但是一般情况下,我们还是使用spring的配置自动完成创建代理织入切面的工作。

通过aop命名空间的<aop:aspectj-autoproxy />声明自动为spring容器中那些配置@aspectJ切面的bean创建代理,织入切面。当然,spring

在内部依旧采用AnnotationAwareAspectJAutoProxyCreator进行自动代理的创建工作,但具体实现的细节已经被<aop:aspectj-autoproxy />隐藏起来了

<aop:aspectj-autoproxy />有一个proxy-target-class属性,默认为false,表示使用jdk动态代理织入增强,当配为<aop:aspectj-autoproxy
poxy-target-class="true"/>时,表示使用CGLib动态代理技术织入增强。不过即使proxy-target-class设置为false,如果目标类没有声明接口,则spring将自动使用CGLib动态代理。

参考:http://www.blogjava.net/fanjs2000/archive/2012/04/25/376552.html

AOP 之 6.4 基于@AspectJ的AOP ——跟我学spring: http://sishuok.com/forum/blogPost/list/0/2471.html

评论(3)

  1. #3 楼 · zmzyj666 · 2017-04-21 09:36

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

    wangchen100 writes:

    [table] ||asd [/table]

  2. #2 楼 · wangchen100 · 2017-03-09 11:22

    ||asd||asd||asd

  3. #1 楼 · wangchen100 · 2017-03-09 11:22

    ||asd

评论功能维护中,当前仅展示历史评论。