Project A has Project B as a maven dependency. project B has a @Component annotated class that extends from SpringBootServletInitializer. I don’t want to start two Spring Boot applications, but I also can’t remove this dependency.
I tried using
@ComponentScan(basePackages = {"com.main"},
includeFilters = {@ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.main.app.*")},
excludeFilters = {@ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.dependency.app.*")},
useDefaultFilters = false)
but it is called anyway.
I was thinking of using @AutoConfiguration in the dependency, so I can potentially disable this behaviour with spring.autoconfigure.exclude, but I’m really lost.
What’s the best approach here?