5

In Spring Boot, is there a way to prevent Auto Configuration of all modules? Basically am looking for something like @DisableAutoConfiguration instead of excluding specific configurations with class names.

2
  • Can you explain why you want to do this? Your question is very succinct but you are potentially throwing away a lot of functionality Commented Sep 7, 2016 at 14:18
  • 1
    Yes, I know it throws away a lot of functionality, but the reason is I would like to have complete control of all beans and their settings. The only feature I currently need from Spring Boot is deployable jar files with embedded containers.
    – user6077173
    Commented Sep 7, 2016 at 14:40

1 Answer 1

8

Auto-configuration is enabled by the @EnableAutoConfiguration annotation. If you don't want to use auto-configuration, then omit this annotation. Note that @SpringBootApplication is itself annotated with @EnableAutoConfiguration so you'll have to avoid using it too. Typically, this would leave your main application class annotated with @ComponentScan and @Configuration.

1
  • Plus 1 for giving the alternatives to (not) using EnableAutoConfiguration or SpringBootApplication. Thank you. Commented Nov 21, 2022 at 20:27