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.
-
Can you explain why you want to do this? Your question is very succinct but you are potentially throwing away a lot of functionality– Graham NicolCommented Sep 7, 2016 at 14:18
-
1Yes, 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.– user6077173Commented Sep 7, 2016 at 14:40
Add a comment
|
1 Answer
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
.
-
Plus 1 for giving the alternatives to (not) using EnableAutoConfiguration or SpringBootApplication. Thank you. Commented Nov 21, 2022 at 20:27