問題:application.properties中的以下配置不生效,返回時間戳spring
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
緣由分析:springboot
攔截器繼承的 WebMvcConfigurationSupport !app
之前是用 WebMvcConfigurerAdapter ,springboot 2.0 建議使用 WebMvcConfigurationSupport 。可是在添加攔截器並繼承 WebMvcConfigurationSupport 後會覆蓋@EnableAutoConfiguration關於WebMvcAutoConfiguration的配置!從而致使全部的Date返回都變成時間戳!orm
解決方法:繼承
實現 WebMvcConfigurer。io
將:form
extends WebMvcConfigurationSupport
改成:配置
implements WebMvcConfigurer
引用:date
SpringBoot攔截器WebMvcConfigurationSupport致使date-format失效引用
@EnableWebMvc,WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter區別