Spring boot- @EnableAutoConfiguration, @SpringBootApplication, @ComponentScan by R4R Team

Spring boot- @EnableAutoConfiguration, @SpringBootApplication, @ComponentScan

Both @SpringBootApplication and @EnableAutoConfiguration can be used to enable the auto-configuration feature of Spring Boot .But there is a difference between them.

The @SpringBootApplication does much more than what @EnableAutoConfiguration do.

The @SpringBootApplication actually a combination of following three annotations:

1.@Configuration which is used in Java-based configuration on Spring framework

2. @ComponentScan to enable component scanning of components you write e.g. @Controller classes

3. @EnableAutoConfgiuration itself, which is used to enable auto-configuration in Spring Boot application.
Leave a Comment: