<context:component-scan>标签

在spring-mvc的配置文件Springmvc-servlet.xml中,要扫描Controller注解的类,用<context:include-filter>标签

<context:component-scan base-package="com.bon.controller">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
    </context:component-scan>

在spring的配置文件中applicationContext.xml中不要扫描Controller注解的类,用<context:exclude-filter>标签

<context:component-scan base-package="com.bon">
         <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>
原文地址:https://www.cnblogs.com/BonnieWss/p/9302118.html