Thursday 5 September 2024

What is the purpose of @SpringBootApplication annotation?

                                         JAVA with Silan Software

@SpringBootApplication annotation represent that the corresponding application is a spring boot application. It is working for three annotations like @Configuration, @EnableAutoConfiguration, and @ComponentScan.

@Configuration : It is a class level annotation indicating that an object is a source of bean definitions. @Configuration classes declare beans through @Bean annotated method.

@EnableAutoConfiguration : It enables to spring boot to auto-configure the application context. So it automatically creates and registers beans based on both the included jar files in the class path and the beans defined by us.

@ComponentScan : It is used for auto detecting and registering spring managed components like beans, controllers, repository, services etc.

No comments:

Post a Comment