A Compact Guide to Spring Boot AutoConfigurator Component
Posted By : Anil Kumar Maurya | 26-Sep-2018
An important key component of Spring Boot Framework is Spring Boot AutoConfigurator and by knowing this you can avoid many configurations to configure in your application. Many critics have given their opinion about Spring IO Platform (Spring Framework) is that “To develop a Spring-based application requires a lot of configuration (Either XML Configuration of Annotation Configuration). Then how to solve this problem.
Spring Boot AutoConfigurator is the solution to this problem. Spring Boot AutoConfigurator reduces the Spring Configuration and its the main advantage of using it. We don't need to define single XML configuration and almost no or minimal Annotation configuration while using spring boot. Its component will take care of providing that information.
For example, if we want to declare a Spring MVC application using Spring IO Platform, then we need to define a lot of XML Configuration like views, view resolvers etc. But if we use Spring Boot Framework, then we don't need to define those XML configurations. Spring Boot AutoConfigurator will take of this.
All the components like views, view resolvers etc will be resolved by Spring Boot AutoConfigurator automatically. We will only have to use “spring-boot-starter-web” jar file in our project build file.
Annotation configuration will also be reduced by using Spring Boot. If we use @SpringBootApplication annotation at class level, then Spring Boot AutoConfigurator will automatically add all required annotations to Java Class ByteCode.
@SpringBootApplication = @Configuration + @ComponentScan + @EnableAutoConfiguration
From the Spring Boot Documentation, we can find the following definition for @SpringBootApplication.
@Target(value=TYPE)
@Retention(value=RUNTIME)
@Documented
@Inherited
@Configuration
@EnableAutoConfiguration
@ComponentScan
public @interface SpringBootApplication
That’s all about Spring Boot AutoConfigurate component.
NOTE:-
All the dependencies required to start a spring boot project will be reduced by Spring Boot Starter while AutoConfigurator reduces the Spring Configuration.
When a Spring Boot application is started the AutoConfigurator will be triggered automatically by Spring Boot Starter.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Anil Kumar Maurya
Anil is an experienced Lead with core knowledge of Java, Spring, and SQL. He has good working experience in banking, finance and trading domain.