Reputation: 13910
I am using a library dependency which contains a @configuration
class that I need to be ignored.
When I do
@SpringBootApplication(exclude={NeedsToBeExcluded.class})
public class Startup {
public static void main(String[] args) {
SpringApplication.run(Startup.class, args);
}
I get the Exception
nested exception is java.lang.IllegalStateException: The following classes could not be excluded because they are not auto-configuration classes: NeedsToBeExcluded.class
Upvotes: 10
Views: 19115
Reputation: 4475
you can use @ComponentScan to exclude classes:
@ComponentScan(basePackages = {"package1","package2"},
excludeFilters = {@ComponentScan.Filter(
type = FilterType.ASSIGNABLE_TYPE,
value = {ExcludedConfigClass.class})
})
Upvotes: 11