springboot 2.0 配置 spring.jackson.date-format 不生效
问题:application.properties中的如下配置不生效,返回时间戳
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
原因分析:
拦截器继承的 WebMvcConfigurationSupport !
以前是用 WebMvcConfigurerAdapter ,springboot 2.0 建议使用 WebMvcConfigurationSupport 。但是在添加拦截器并继承 WebMvcConfigurationSupport 后会覆盖@EnableAutoConfiguration关于WebMvcAutoConfiguration的配置!从而导致所有的Date返回都变成时间戳!
解决方法:
实现 WebMvcConfigurer。
将:
extends WebMvcConfigurationSupport
改为:
implements WebMvcConfigurer
引用:
SpringBoot拦截器WebMvcConfigurationSupport导致date-format失效
@EnableWebMvc,WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter区别
springboot 2.0 配置 spring.jackson.date-format 不生效的更多相关文章
- springboot 2.0 配置 logback
springboot2.0默认已经引入日志jar依赖,所以直接配置日志信息就可以了. 在application.properties中加入: logging.config=classpath:logb ...
- springboot 2.0配置集成thymeleaf的坑
Servlet.service() for servlet [dispatcherServlet] in context with path [] java.lang.NoClassDefFoundE ...
- SpringBoot中mybatis配置自动转换驼峰标识没有生效
mybatis提供了一个配置: #开启驼峰命名转换 mybatis.configuration.map-underscore-to-camel-case=true 使用该配置可以让mybatis自动将 ...
- SpringBoot+MyBatis Plus对Map中Date格式转换的处理
在 SpringBoot 项目中, 如何统一 JSON 格式化中的日期格式 问题 现在的关系型数据库例如PostgreSQL/MySQL, 都已经对 JSON 类型提供相当丰富的功能, 项目中对于不需 ...
- springboot 2.0 Redis command timed out的解决
环境:springboot 2.0.7 spring data redis springboot从1.x升级到2.x后,spring data redis使用的redis客户端驱动从1.x的jedis ...
- 【SpringBoot】14. SpringBoot多环境配置
SpringBoot多环境配置 Spring Boot 1.5.19.RELEASE 假设项目中需要3个环境--开发.测试.生产 profile :代表的就是一个环境变量 语法结构:applicati ...
- spring boot @ResponseBody转换JSON 时 Date 类型处理方法,Jackson和FastJson两种方式,springboot 2.0.9配置fastjson不生效官方解决办法
spring boot @ResponseBody转换JSON 时 Date 类型处理方法 ,这里一共有两种不同解析方式(Jackson和FastJson两种方式,springboot我用的1.x的版 ...
- Springboot 2.0.x 集成基于Centos7的Redis集群安装及配置
Redis简介 Redis是一个基于C语言开发的开源(BSD许可),开源高性能的高级内存数据结构存储,用作数据库.缓存和消息代理.它支持数据结构,如 字符串.散列.列表.集合,带有范围查询的排序集,位 ...
- SpringBoot零XML配置的Spring Boot Application
Spring Boot 提供了一种统一的方式来管理应用的配置,允许开发人员使用属性properties文件.YAML 文件.环境变量和命令行参数来定义优先级不同的配置值.零XML配置的Spring B ...
随机推荐
- 【oracle】PLS-00103: 出现符号 "end-of-file"
begin xxxxx end; 修改xxxxx为xxxxx:就好了
- php 重复问题
结果: 结论: 尽量在方法内用变量去接受重复的参数或重复的方法/结果,消耗的时间积少成多
- 如何封装$on,$emit,$off——学vue前你必须懂得封装!
let evevtListenr = {} 封装$on const $on = (eventName,cb)=>{ if(!evevtListenr[eventName]){ ...
- Win10(64位)安装汇编环境(MASM)
1:需要的文件 需要的安装包:这些百度都能下载找到 1).DOSBox 链接: 2) .MASM5.0 链接: 3).DEBUG 链接: 下面给出我们打包的环境 直接可用: (汇编我并不需要关注安装这 ...
- linux命令--查找与帮助
一.搜寻命令 1.whereis命令 whereis是搜索系统命令的命令,也就是说,whereis 命令不能搜索普通文件, 而只能搜索系统命令. 命令名称:whereis 英文原意:locate th ...
- ETCD:系统限制
原文地址:System limits 请求大小限制 etcd被设计用来处理小键值对典型的如元数据.较大的请求数据也起作用,但可能会增加其他请求的延迟.默认情况下,任意的请求最大的空间为1.5MiB,这 ...
- Java题库——Chapter12 异常处理和文本IO
异常处理 1)What is displayed on the console when running the following program? class Test { public stat ...
- SpringCloud的入门学习之概念理解、Feign负载均衡入门
1.Feign是SpringCloud的一个负载均衡组件. Feign是一个声明式WebService客户端.使用Feign能让编写Web Service客户端更加简单, 它的使用方法是定义一个接口, ...
- 项目部署到Linux上遇到的坑
作者:晨钟暮鼓c个人微信公众号:程序猿的月光宝盒 1.本地Navicat for MySQL无法连接至服务器(Centos 7 x86_64 bbr) 1045错误: 解决步骤: 1.查看用户名密 ...
- python的exe反编译
目录 python的exe反编译 方法一.使用archive_viewer.py提取pyc 方法二.使用pyinstxtractor.py提取pyc python的exe反编译 驱动人生样本为pyth ...