1. Concept library
  2. Java & Spring Boot
  3. Module 6: Spring Boot fundamentals

Concept

Auto-configuration

Spring Boot configures beans for the libraries on your classpath, with sensible defaults you can override. Adding a starter dependency is often all it takes to get a working web server or database connection.

What a session covers

The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.

  1. Explain what a starter brings and how auto-configuration decides what to create
  2. Add a starter and explain the beans it configures
  3. Override a default by defining your own bean

In practice

A few lines that show Auto-configuration doing its job.

Java
@SpringBootApplication      // = @Configuration + @EnableAutoConfiguration + @ComponentScan
public class App {
    public static void main(String[] args) { SpringApplication.run(App.class, args); }
}

// Define your own bean and the matching auto-configured one steps aside:
@Bean
ObjectMapper objectMapper() { return new ObjectMapper().findAndRegisterModules(); }

The common mistake

Watch for

Fighting auto-configuration with @ComponentScan on the wrong package or an @Configuration that duplicates a starter. Run with --debug to see the condition evaluation report and what was configured and why.

What to know first

Your roadmap puts these before Auto-configuration, unless you already know them.

How it stays learned

Once a session shows you understand Auto-configuration, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.

  1. Day 3First recall, while it is fresh
  2. Day 7Second, a week on
  3. Day 18Last, when it has settled

Where it leads

Topics that build on Auto-configuration.

Next in the moduleDependency injection →