springboot启动排除package
< 返回列表时间: 2020-07-11来源:OSCHINA
根据jar包进行排除过滤
@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX,
pattern = {"com.sample.*","com.demo.*"}))

根据类进行过滤
@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
classes = {RedissonConfig.class}))

@Filters指过滤规则,FilterType指定过滤的规则:
FilterType.ANNOTATION:按照注解
FilterType.ASSIGNABLE_TYPE:按照给定的类型
FilterType.ASPECTJ:使用ASPECTJ表达式
FilterType.REGEX:使用正则指定
FilterType.CUSTOM:使用自定义规则
热门排行