Skip to main content

Auto Configuration

Auto-configuration is the absolute core feature behind Spring Boot.

How it works

When you decorate your main class with the generic @SpringBootApplication annotation, it aggregates exactly 3 specific core annotations:

  1. @EnableAutoConfiguration: Automatically registers database beans and web beans intelligently.
  2. @ComponentScan: Scans local package directories systematically to find your custom @Service and @Controller classes.
  3. @Configuration: Marks the class as a custom Bean source.

Spring Boot parses your pom.xml. If the framework sees that the H2 memory database dependency is loaded, but detects absolutely no explicit manual JDBC connection mapping inside your application.properties, it safely configures a default in-memory database automatically on startup.