<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>

 

posted @ 2018-07-12 21:57  第二人生Bonnie  阅读(288)  评论(0编辑  收藏  举报