SpringBoot is configured with jackson format, but it does not take effect

SpringBoot is configured with jackson format, but it does not take effect

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/test?useSSL=false
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver
    platform: mysql

  jackson:
    date-format:  yyyy-MM-dd HH:mm:ss
    time-zone:  GMT+8
Mar.13,2021

  1. whether jackson dependency is introduced
  2. try to put yyyy-MM-dd HH:mm:ss in single quotation marks, that is,
jackson:
    date-format:  'yyyy-MM-dd HH:mm:ss'
    time-zone:  GMT+8

SpringBoot already has classes that inherit from WebMvcConfigurationSupport, and @ Configuration, so configurations in yml or properties that are not supported will not take effect.

Custom configuration needs to be added to the subclass of WebMvcConfigurationSupport

Menu