【发布时间】:2017-11-07 13:23:04
【问题描述】:
我已经在调度器 servlet 中配置了组件扫描 代码:
<context:component-scan base-package="com.web.rest"
annotation-config="true" scoped-proxy="targetClass" />
<annotation-driven />
此代码正在扫描“com.web.rest”包, 现在我必须使用@ComponentScan 注解再扫描一个包,
示例:
@Configuration
@ComponentScan(basePackages = {"com.web.utils"})
@Component
public class FileUtil {
}
但是@ComponentScan(basePackages = {"com.web.utils"}) 对我不起作用,它没有扫描“com.web.utils”包
我们可以在同一个项目中使用注解驱动和xml配置组件扫描吗??
【问题讨论】:
标签: spring-mvc