Mahesh Kale
Mahesh Kale

Reputation: 19

Disable Spring Boot Configuration

How to disable Spring Boot auto configuration.I want to disable the data source auto configuration.

Upvotes: 1

Views: 1996

Answers (1)

Imranmadbar
Imranmadbar

Reputation: 5480

Try this two way:

Properties configuration

    spring:
      profiles: app-profile
      autoconfigure:
        exclude:
        - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
        - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
        

Class level configuration

    @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
    public class SpringBootApp {
    public static void main(String[] args) {
        SpringApplication.run(SpringBootApp.class, args);
    }

Reference:

https://docs.spring.io/spring-boot/docs/1.4.1.RELEASE/reference/html/using-boot-auto-configuration.html

Upvotes: 2

Related Questions