I have a component that I want to exclude from a @ComponentScan
in a particular @Configuration
:
@Component(\"foo\") class Foo {
...
I had an issue when using @Configuration, @EnableAutoConfiguration and @ComponentScan while trying to exclude specific configuration classes, the thing is it didn't work!
Eventually I solved the problem by using @SpringBootApplication, which according to Spring documentation does the same functionality as the three above in one annotation.
Another Tip is to try first without refining your package scan (without the basePackages filter).
@SpringBootApplication(exclude= {Foo.class})
public class MySpringConfiguration {}