Spring的@ComponentScan excludeFilters多个过滤器

时间:2018-05-08 09:38:13

标签: spring-boot

我需要从以下位置排除多种模式:

@ComponentScan(
    basePackages = "com.data",
    excludeFilters = @ComponentScan.Filter(
        type = FilterType.REGEX,
        pattern = "package.*"
    )
)

我正在使用弹簧靴LATEST。

1 个答案:

答案 0 :(得分:3)

excludeFilters采用数组

@ComponentScan(
    basePackages = "com.example",
    excludeFilters = {
        @ComponentScan.Filter(...),
        @ComponentScan.Filter(...),
        @ComponentScan.Filter(...),
    }
)