Demo: overriding Jackson's auto-configuration
On This Lesson 3 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
change JSON date output in two ways.
Draft outline details
Step by step
- Call an endpoint returning a date and observe the format (the default depends on version; verify version before recording).
- Set a property such as
spring.jackson.serialization.write-dates-as-timestamps=false; observe. - Define a
Jackson2ObjectMapperBuilderCustomizerbean (or the customizer for the current Jackson line) to set a format. - Planned mistake: define a whole new
ObjectMapperbean and lose Boot's module registration and settings. Fix: prefer the property or customizer; define your own mapper only when you need full control. - Check the conditions report: the default mapper bean is skipped when you define your own.
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.