需要排除某个 Bean
时,
通过类排除 ASSIGNABLE_TYPE
1 2 3
| @ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {DEMO.class})}, basePackages = {"com"})
|
通过类排除
1 2 3
| @ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {DEMO.class})}, basePackages = {"com"})
|
基于注解排除 ANNOTATION
1 2 3
| @ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = MyAnnotation.class )}, basePackages = {"com"})
|
通过正则排除 REGEX
1 2 3
| @ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.REGEX, pattern = "com\.maxzhao\..*\.controller\..*" )}, basePackages = {"com"})
|
本文地址: https://github.com/maxzhao-it/blog/post/31330vxcvgfgdfg/