问题: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区别