JdbcTemplate DateTime转java.util.Date时区错误

spring.datasource.url=jdbc:mysql://192.168.0.201:3306/xxx?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8

设置了

serverTimezone=GMT%2B8

JdbcTemplate代码写成

map.put("list",jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(FireAlarmBean.class)));

时区不对,格式也不对。

在FireAlarmBean中修改

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

猜你喜欢

转载自blog.csdn.net/zjy660358/article/details/125615542
今日推荐