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