优雅的整合SSM之<context:component-scan/>

  去除applicationContext.xml和spring-mvc.xml中的重复部分。

1、applicationContext.xml中

<context:component-sacn base-package="">

  <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />

</context:component-sacn>

2、spring-mvc.xml中

<context:component-scan
        base-package="cn.rigid.hoistmnteg.controller"
        use-default-filters="false">
        <context:include-filter type="annotation"
            expression="org.springframework.stereotype.Controller" />
    </context:component-scan>
原文地址:https://www.cnblogs.com/jndx-ShawnXie/p/11755900.html