Junior — Middle
What happens in Spring Boot if auto-configuration is specified in the starter module?
sobes.tech AI
Answer from AI
If you specify auto-configuration in the starter module in Spring Boot, then when this starter is included in the project, the corresponding configuration will automatically be applied, setting up the necessary beans and parameters without additional code.
This means that when Spring Boot starts:
- It will find all classes with the
@Configurationand@EnableAutoConfigurationannotations inside the starter. - It will automatically create and register the required components in the application context.
- It allows you to use the starter's functionality immediately, without manual configuration.
For example, if you include spring-boot-starter-web, it automatically configures the embedded web server, controllers, JSON serialization, and other components for a web application.
Thus, auto-configuration in the starter simplifies configuration and speeds up development, allowing you to focus on business logic.