@ComponentScan:扫描
@ComponentScan告诉Spring哪个packages的用注解标识的类会被spring自动扫描并且装入bean容器
如:扫描com.liuy.controller
@ComponentScan(basePackages = { "com.liuy.controller" })
excludeFilters:指定不适合组件扫描的类型
如:不扫描含有@ExcludeFromComponentScan注解的类或接口
@ComponentScan(excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = ExcludeFromComponentScan.class) })
时间: 2024-10-12 04:04:52