We can use the exclude attribute of @EnableAutoConfiguration to disable them, as shown in the following example:
import org.springframework.boot.autoconfigure.*;
import org.springframework.boot.autoconfigure.jdbc.*;
import org.springframework.context.annotation.*;
@Configuration
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class MyConfiguration {
}
If the class is not on the classpath, we can use the excludeName attribute of the annotation and specify the fully qualified name instead. Finally, we can also control the list of auto-configuration classes to exclude by using the spring.autoconfigure.exclude property.
We can use exclude property as shown below to disable specific auto configuration
@EnableAutoConfiguration(exclude={OurClasssName.class})