问题: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返回都变成时间戳!.net
解决方法:orm
实现 WebMvcConfigurer。blog
将:继承
extends WebMvcConfigurationSupport
改成:io
implements WebMvcConfigurer
引用:form
SpringBoot拦截器WebMvcConfigurationSupport致使date-format失效配置
@EnableWebMvc,WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter区别 --------------------- 做者:2yung 来源:CSDN 原文:https://blog.csdn.net/qq_30912043/article/details/80967352 版权声明:本文为博主原创文章,转载请附上博文连接!