@ComponentScan:扫描
@ComponentScan告诉Spring哪个packages的用注解标识的类会被spring自动扫描并且装入bean容器
如:扫描com.liuy.controller
1
|
@ComponentScan
(basePackages = {
"com.liuy.controller"
})
|
如:不扫描含有@ExcludeFromComponentScan注解的类或接口
1
|
@ComponentScan
(excludeFilters = {
@ComponentScan
.Filter(type = FilterType.ANNOTATION, value = ExcludeFromComponentScan.
class
) })
|
本文转自我爱大金子博客51CTO博客,原文链接http://blog.51cto.com/1754966750/1947226如需转载请自行联系原作者
我爱大金子