What is the role of @SpringBootApplication annotation in Spring Boot?

MCQ: What is the role of @SpringBootApplication annotation in Spring Boot?

a) It is used to define a batch job
b) It is used to mark a configuration class
c) It is a convenience annotation that adds @SpringBootConfiguration, @EnableAutoConfiguration, and @ComponentScan
d) It is used for defining RESTful web services

Answer:

c) It is a convenience annotation that adds @SpringBootConfiguration, @EnableAutoConfiguration, and @ComponentScan

Explanation:

@SpringBootApplication is a meta-annotation that combines @SpringBootConfiguration, @EnableAutoConfiguration, and @ComponentScan annotations to simplify Spring Boot application setup.


Comments