Friday, November 1, 2019

Spring Boot: Disabling Specific Auto-configuration

Spring Boot Auto Configuration is non-invasive. It allows you to control, what needs to be loaded and what not.

There are two ways you can exclude specific config exclusion

1. By Annotation: 

We can exclude using @EnableAutoConfiguration(exclude -{*.class})

  class like: DataSourceAutoConfiguration.class

We can exclude using @SpringBootApplication(exclude={*.class})

  class like: DataSourceAutoConfiguration.class

2. By Property Value:

add fully qualified name of the class in 'spring.autoconfigure.exclude' property like:

spring.autoconfigure.exclude= org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration







No comments: