![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SpringBoot
C_纯属虚构
这个作者很懒,什么都没留下…
展开
-
Jackson对时间的序列化和反序列化及时区问题
问题描述:Jackson是springboot中集成的一个对象与字符串转换的工具,其中日期的格式转化问题困扰许多人,时间格式问题和时区问题。入参时间格式(反序列化,接收json字符串转化为实体类)当json字符串中包含有时间字符串存在时,反序列化可能会报错。如果在spring和springmvc环境下可以使用:@DateTimeFormate(pattern = "yyyy-MM-dd HH:mm:ss")如果在springboot环境下使用DateTimeFormate,可能会一下错误:原创 2021-06-06 15:08:32 · 9920 阅读 · 0 评论 -
log4j2.xml完美配置
参考:原创 2021-05-19 18:58:11 · 187 阅读 · 0 评论 -
springboot中普通类使用@Autowired注入实例,实例却为null
在一次普通类中使用@Autowired、@Resource或者@Autowired+@Qualifier对变量进行自动注入,在spring容器中,该实例对象已经注册后成功,但是自动注入失败。原因分析: 普通类是无法实现@Autowired等自动注入的,需要将该类也注入到spring容器中,像常见的Controller层中使用@Controller将类加入容器,再自动注入Service层的实例;Service层使用@Service将类加入到容器,再自动注入DAO层的实例;DAO层使用@Mapper将类加入原创 2021-03-22 10:21:35 · 3316 阅读 · 0 评论 -
关于springboot配置数据库连接时报错问题
一、在springboot配置druid连接池时发现的错误,错误信息如下:Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one timezone. You must configure either the server or JDBC dri原创 2021-03-18 18:49:30 · 1250 阅读 · 0 评论 -
时间格式化,JsonFormat和DateTimeFormate使用的区别
一、时间类型Date和LocalDateTime的时区区别实体类User:public User { ... // 表示查询时不查询此字段 @JsonFormat(pattern = "yyyyMMdd'T'HHmmss'Z'") private Date createTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime updateTime; ...}前端查询访问返回的结果,如下:从原创 2020-12-03 14:09:14 · 584 阅读 · 0 评论