当需要使用CGLIB代理和@AspectJ自动代理支持,请按照如下的方式设置 <aop:aspectj-autoproxy> 的 proxy-target-class 属性:
<aop:aspectj-autoproxy proxy-target-class="true"/>
在基于主机方式配置Spring的配置文件中,你可能会见到<context:annotation-config/>这样一条配置,他的作用是式地向 Spring 容器注册
AutowiredAnnotationBeanPostProcessor、CommonAnnotationBeanPostProcessor、
PersistenceAnnotationBeanPostProcessor 以及 RequiredAnnotationBeanPostProcessor 这 4 个BeanPostProcessor。
注册这4个 BeanPostProcessor的作用,就是为了你的系统能够识别相应的注解
<embed src='http://www.docin.com/DocinViewer-590992397-144.swf' width='650' height='490' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'></embed>
本文介绍如何在Spring配置文件中启用CGLIB代理和@AspectJ自动代理,并解释了<context:annotation-config/>的作用,即注册多个BeanPostProcessor,使系统能识别@Autowired等注解。
295

被折叠的 条评论
为什么被折叠?



