The date returned by jdbcTemplate is automatically added by 1.

1. When I use spring boot2.0,jdbcTemplate to query the database, I add 1 to the date value. I don"t know why?
the database is mysql5.7,. Here is the part of my code:

String sql = "select * from v_item_data_last t where t.index_type_id=? order by t.index_order asc,t.target_order asc";
List<Map<String, Object>> data_list = this.jdbcTemplate.queryForList(sql, new Object[] { indexType });

there is a date field in this sql statement. It is normal for me to execute the statement directly in navicat, but it is executed in jdbcTemplate. The date field is automatically added by 1. Ask for help.

Jan.12,2022
I have found the answer to the question of

. It turns out that it is the time zone setting of msyql. Add `[ mysqld]
default-time_zone ='+ 8msyql 00' , while application.properties sets spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=Asia/ Shanghai`.
this problem did not exist in spring-boot-1.5.3 before, because the mechanism of the two is different when negotiating the time zone with mysql.

Menu