← All tutorials

GoCareerGo Tutorials

Spring Boot Tutorial

Auto-configuration, REST APIs, JPA, AOP, caching, microservices and Spring Cloud.

Auto-Configuration

Spring Boot inspects what's on the classpath and automatically configures beans you'd otherwise wire up by hand.

@EnableAutoConfiguration (bundled inside @SpringBootApplication) scans a list of auto-configuration classes, each guarded by @Conditional checks — e.g. 'only configure a DataSource if a JDBC driver is on the classpath'.

  • @ConditionalOnClass / @ConditionalOnMissingBean drive most auto-config decisions
  • You can always override any auto-configured bean by defining your own @Bean
  • spring.factories / AutoConfiguration.imports registers which classes to consider
Tip

Mention @ConditionalOnMissingBean specifically — it's how your own beans always win over defaults.