AOP不起作用的原因之一

-servlet.xml配置context:component-scan后,Spring在扫描包时,会将所有带 @Service注解的类都扫描到容器中。而-servlet.xml和applicationContext.xml不是同时加载。等到加载applicationContext.xml时,由于容器中已经存在service类,使得cglib将不对service类进行代理,导致的结果就是applicationContext中的aop配置不起作用。

posted on 2016-09-24 13:02  coderland  阅读(444)  评论(0编辑  收藏  举报

导航