Spring / Spring Boot
Difference between @EnableAutoConfiguration and @SpringBootApplication.
| @SpringBootApplication. | @EnableAutoConfiguration. |
| @SpringBootApplication allows you to run the Main class as a JAR with an embedded container. It enables Java configuration, and it also enables Component Scanning. | @EnableAutoConfiguration enables automatic configuration features of the Spring Boot application, which to automatically configure your Spring application based on the jar dependencies that you have added. For example, If HSQLDB is on your classpath, and you have not manually configured any database connection beans, then we will auto-configure an in-memory database.. |
| SpringBootApplication combines of 3 annotations: @Configuration, used for Java-based configuration on Spring framework, @ComponentScan to enable component scanning of components, and @EnableAutoConfiguration itself, which is used to allow for auto-configuration in Spring Boot application. | Its primary task is to enable auto configuration. |
| allows excluding auto configuration. | EnableAuto configuration also allows exclusion. |
More Related questions...