SpringMvc和Spring的父子容器关系

例如:

applicationContext-service中配置:

<!-- 扫描包加载Service实现类 -->

<context:component-scan base-package="com.taotao"></context:component-scan>

会扫描@Controller@Service@Repository@Compnent

SpringmvcXml中不扫描。

结论:springmvc。不能提供服务,因为springmvc子容器中没有controller对象。


相关文章: