عرض عملي: تجاوز الإعداد التلقائي لـ Jackson
في هذا الدرس 3 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
change JSON date output in two ways.
تفاصيل المخطط المبدئي
خطوة بخطوة
- 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.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.