@ComponentScan:掃描java
@ComponentScan告訴Spring哪一個packages的用註解標識的類會被spring自動掃描而且裝入bean容器spring
如:掃描com.liuy.controlleride
@ComponentScan(basePackages = { "com.liuy.controller" })
如:不掃描含有@ExcludeFromComponentScan註解的類或接口spa
@ComponentScan(excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = ExcludeFromComponentScan.class) })