Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring's @ComponentScan excludeFilters multiple filters

Tags:

spring-boot

I need to exclude multiple patterns of packages from:

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

I am using spring boot LATEST.

like image 737
Prostitutor Avatar asked Jan 02 '23 10:01

Prostitutor


1 Answers

excludeFilters takes an array

@ComponentScan(
    basePackages = "com.example",
    excludeFilters = {
        @ComponentScan.Filter(...),
        @ComponentScan.Filter(...),
        @ComponentScan.Filter(...),
    }
)
like image 71
ptomli Avatar answered Feb 23 '23 12:02

ptomli