Share:- Whatsapp Facebook Facebook

------------------------------------- Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.


0 votes
What is the use of @SpringBootApplication annotation?
in Spring Boot by

1 Answer

0 votes
@SpringBootApplication annotation:- @SpringBootApplication annotation is a combination  of three annotations like following:-
@SpringBootApplication = @Configuration + @ComponentScan + @EnableAutoConfiguration

@Configuration:- This annotation marks a class as Configuration class in Java-based configuration. It is most important if you doing Java-based configuration over XML configuration.

@ComponentScan:- This annotation enables the component-scanning so that the web controller classes and other components. You will be automatically discovered and registered as beans in Spring's Application Context. All the @Controller classes we can write this annotation.

@EnableAutoConfiguration:- This annotation enables the magical auto-configuration feature in  Spring Boot, that can be automatically configure for you.

Adding Spring Boot Maven Dependencies:-

Spring Boot Application Class:-
Now i am going to create a java class with main method, mark it with @SpringBootApplication annotation and invoke method.
by (4.3k points)