【发布时间】:2010-07-01 01:34:26
【问题描述】:
有点迷茫,基本的spring mvc app有这个:
app-config.xml
<context:component-scan base-package="org.springframework.samples.mvc.basic" />
并且 mvc-config.xml 有:
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven />
你真的需要两者吗?
对于组件扫描,这是否意味着如果我没有放置正确的包路径,我的 @Controller 和 @Service 标记将不起作用? 如果我需要多个包裹,是否只需复制条目?
我尝试只使用 mvc:annotation-driven 但这不起作用,我必须将 com.example.web.controllers 放在组件扫描 xml 节点中才能使其工作。
【问题讨论】:
标签: spring spring-mvc annotations