博客园
1.在applicationContext.xml中配置:1
2
3
4
5<!-- Spring容器中注册非@controller注解的Bean -->
<context:component-scan base-package="com.hafiz.www">
<!--排除@Controller-->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
2.applicationContext-MVC.xml中配置
1 | <!-- SpringMVC容器中只注册带有@controller注解的Bean --> |