@ComponentScan 排除不需要收集的类
在SpringBoot中,当希望某些类不希望被@ComponentScan扫描到时,可以通过excludeFilters设置排除。代码如下
1 2 3 4 5 |
@ComponentScan(basePackages={"com.hanson"} ,excludeFilters={ //GetWay不需要 @ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE, value=AuthenticationFilter.class), @ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE, value=RefreshTokenSchedule.class)}) |
这样,当自动扫描时注册的类就不会被扫描到。
©版权声明:本文为【翰林小院】(huhanlin.com)原创文章,转载时请注明出处!
发表评论