Multiple component-scan

僤鯓⒐⒋嵵緔 提交于 2019-12-24 07:18:22

问题


I used Spring ROO to generate a MVC Project. I see the first component-scan at webmvc-config.xml loaded via org.springframework.web.servlet.DispatcherServlet in web.xml file:

<context:component-scan base-package="com.nexlabs.countryapp" use-default-filters="false">
    <context:include-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
</context:component-scan>
<mvc:resources location="/, classpath:/META-INF/resources/" mapping="/resources/**"/>

Now in another component-scan at classpath:/META-INF/resources/spring/applicationContext.xml:

<context:component-scan base-package="com.nexlabs.countryapp.*">
    <context:exclude-filter expression=".*_Roo_.*" type="regex"/>
    <context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
</context:component-scan>

Question 1: Why are there two component-scan in 2 different places? Question 2: What is the scope of "context" tag? Does the setting in context tag only apply to the specific XML file?

来源:https://stackoverflow.com/questions/21773092/multiple-component-scan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!