Skip to content
Ameen Abozaid
Planned lessonJNR-011-L03

Auto-configuration and conditions

  • Lesson 3 of 8
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

explain how Boot decides what to create.

Planned topics

  • Auto-configuration classes are bundled with starters and run at startup.
  • Each is guarded by conditions: @ConditionalOnClass (a library is present), @ConditionalOnMissingBean (you have not defined your own), @ConditionalOnProperty.
  • Result: add a library and a bean appears; define your own bean and Boot backs off.
  • Nothing magic: it is ordinary @Configuration with conditions.
Draft outline details

Demonstration

java
@Bean
@ConditionalOnMissingBean
ObjectMapper objectMapper() { ... }   // simplified shape

Check your understanding

What does @ConditionalOnMissingBean mean for your own bean?

Show answer

Boot's default is skipped.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.