当前位置: 首页 > wzjs >正文

html网站制作答辩ppt写文章免费的软件

html网站制作答辩ppt,写文章免费的软件,seo快速优化报价,基础很差去公司做网站我们对字段的日期格式化时一般会用注解: JsonFormat(pattern "yyyy-MM-dd HH:mm:ss", timezone "GMT8")private Date createDate;但是每个字段都要写也太麻烦了 不是我的全局化作风 在application.yml中配置全局时间格式化只会对Date类型有用: jackson:d…

我们对字段的日期格式化时一般会用注解:

 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")private Date createDate;

但是每个字段都要写也太麻烦了 不是我的全局化作风 在application.yml中配置全局时间格式化只会对Date类型有用:

  jackson:date-format: yyyy-MM-dd HH:mm:sstimezone: GMT+8serialization:write-dates-as-timestamps: falsemvc:format:date: yyyy-MM-ddtime: HH:mm:ssdate-time: yyyy-MM-dd HH:mm:ss

以上是无效的 java8的时间模块比如LocalDateTime就没用了 时间依然中间有个T 所以需要额外配置 自定义一个配置类顺便把反序列化也配了:

package com.hmdp.config;import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;@Configuration
public class JacksonConfigure {@Beanpublic Jackson2ObjectMapperBuilderCustomizer customizer(@Value("${spring.mvc.format.date-time}") String dateTimeFormatPattern,@Value("${spring.mvc.format.date}") String dateFormatPattern,@Value("${spring.mvc.format.time}") String timeFormatPattern) {return jacksonObjectMapperBuilder -> {JavaTimeModule javaTimeModule = new JavaTimeModule();DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(dateTimeFormatPattern);DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(dateFormatPattern);DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern(timeFormatPattern);javaTimeModule.addSerializer(new LocalDateTimeSerializer(dateTimeFormatter));javaTimeModule.addSerializer(new LocalDateSerializer(dateFormatter));javaTimeModule.addSerializer(new LocalTimeSerializer(timeFormatter));javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(dateTimeFormatter));javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(dateFormatter));javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(timeFormatter));jacksonObjectMapperBuilder.modules(javaTimeModule);};}
}

加上这些配置后还要检查一下项目有没有jackson-datatype-jsr310-2.13.5.jar这个依赖 这是jackson对java8时间模块的支持包 没有pom.xml就要加上:

<dependency><groupId>com.fasterxml.jackson.datatype</groupId><artifactId>jackson-datatype-jsr310</artifactId><version>2.13.5</version> 
</dependency>

大功告成

http://www.dtcms.com/wzjs/131819.html

相关文章:

  • 连云港建设厅官方网站seo都用在哪些网站
  • 重庆神态网站建设企业培训课程清单
  • wordpress 连接丢失网站关键词优化排名软件系统
  • 网站域名价格免费发布活动的平台
  • 在某外国网站做代购百度指数在哪里看
  • 网站建设宣传单素材网站创建免费用户
  • 承接网站建设广告语如何在百度发广告推广
  • 南京h5网站建设网站平台做推广
  • wordpress企业站源码百度网站安全检测
  • 化工销售怎么做网站百度推广的五大优势
  • 深圳o2o网站建设推广app拉人头赚钱
  • 用帝国做网站好做吗免费学生html网页制作成品
  • 网站建设员课程网站模板建站公司
  • 做av网站赚钱吗网站秒收录工具
  • 南宁做网站推广软文代写
  • better wordpress minify设置江西网络推广seo
  • 域名网站负责人的责任seo网站培训优化怎么做
  • 微网站建设流程深圳网站公司排名
  • vi设计主要做什么专业培训seo的机构
  • 从哪里设置网站关键词广东疫情动态人民日报
  • 手机网站 制作餐饮品牌全案策划
  • 建设一个网站的步骤怎么根据视频链接找到网址
  • 杭州哪个网站建设最好什么叫关键词
  • 东莞网站建设怎么做广州疫情防控措施
  • 安远网站建设市场营销考试题目及答案2022
  • 湖南盈达电力建设有限公网站湖北网站设计
  • html5标准网站建设免费站推广网站在线
  • 网站建设一般多少钱手机百度快照
  • 网站优化图片链接怎么做广州白云区今天的消息
  • 分类信息网站怎么做流量站长工具 seo查询