JdbcTemplate DateTime to java.util.Date time zone error

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

already setup

serverTimezone=GMT%2B8

The JdbcTemplate code is written as

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

The time zone is wrong and the format is wrong.

 

Modify in FireAlarmBean

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

 

Guess you like

Origin blog.csdn.net/zjy660358/article/details/125615542