Spring / Spring Boot
How do you disable a specific auto-configuration class in Spring boot?
Use @SpringBootApplication(exclude = ThatAutoConfiguration.class) or spring.autoconfigure.exclude. Prefer exclude over fighting the auto-config with properties.
Use exclude attribute of @EnableAutoConfiguration to specific auto-configuration classes that you do not want being auto-configured.
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,SecurityAutoConfiguration.class})
if the class is not on the classpath, use the excludeName attribute of the annotation and specify the fully qualified name instead.
@EnableAutoConfiguration(excludeName={Employee.class})
You can also control the list of auto-configuration classes to exclude via the spring.autoconfigure.exclude property.
More Related questions...