Bean 被创建两次 ? ? Spring 的 IOC 容器不应该扫描 SpringMVC 中的 bean, 对应的 SpringMVC 的 IOC 容器不应该扫描 Spring 中的 bean
<context:component-scan base-package="com.nemo.springmvc">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.ControllerAdvice"/>
</context:component-scan>
<context:component-scan base-package="com.nemo.springmvc" use-default-filters="false">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.ControllerAdvice"/>
</context:component-scan>
原文:https://www.cnblogs.com/blknemo/p/13498279.html