Auto-configuration and conditions
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
@Configurationwith conditions.
Draft outline details
Demonstration
@Bean
@ConditionalOnMissingBean
ObjectMapper objectMapper() { ... } // simplified shapeCheck 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.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.