分享

Spring: context:exclude-filter 与 context:include-filter

 风中的眼睛_ 2013-12-22

1 在主容器中(applicationContext.xml),将Controller的注解打消掉

  1. <context:component-scan base-package="com">  
  2.   <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />  
  3. </context:component-scan>   

2 而在springMVC配置文件中将Service注解给去掉 

  1. <context:component-scan base-package="com">  
  2.   <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />  
  3.   <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" />  
  4.   </context:component-scan>   

因为spring的context是父子容器,所以会产生冲突,Controller会进步前辈行扫描装配,而此时的Service还没有进行事务的加强处理惩罚,获得的将是原样的Service(没有经过事务加强处理惩罚,故而没有事务处理惩罚才能) ,最后才是applicationContext.xml中的扫描设备进行事务处理惩罚

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多