Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

What do you understand by auto-configuration in Spring Boot and how to disable the auto-configuration?

Pragya Keshap answered on February 23, 2023 Popularity 4/10 Helpfulness 1/10

Contents


More Related Answers

  • spring boot id auto generated
  • Can you disable the default web server in the Spring Boot application?
  • What is Spring Boot Auto-configuration?
  • springBoot Disable a Specific Auto-Configuration
  • How does Spring do Autowiring?
  • how to disable the auto-configuration?
  • springBoot Register a Custom Auto-Configuration
  • What Is the Difference Between @SpringBootApplication and @EnableAutoConfiguration Annotation?
  • Some of the autoconfiguration policies baked into Spring Boot
  • How to disable a specific auto-configuration class?
  • Disable the use of the config server when running Spring Boot-based automated tests
  • How do you externalize configuration using Spring Boot?

  • What do you understand by auto-configuration in Spring Boot and how to disable the auto-configuration?

    0

    Auto-configuration is used to automatically configure the required configuration for the application. For example, if you have a data source bean present in the classpath of the application, then it automatically configures the JDBC template. With the help of auto-configuration, you can create a Java application in an easy way, as it automatically configures the required beans, controllers, etc.

    To disable the auto-configuration property, you have to exclude attribute of @EnableAutoConfiguration, in the scenario where you do not want it to be applied.

    1

    @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})

    If the class is not on the classpath, then to exclude the auto-configuration, you have to mention the following code:

    1

    @EnableAutoConfiguration(excludeName={Sample.class})

    Apart from this, Spring Boot also provides the facility to exclude list of auto-configuration classes by using the spring.autoconfigure.exclude property. You can go forward, and add it either in the application.properties or add multiple classes with comma-separated 


    Popularity 4/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Feb 23 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.