The front end transmits a time value: 2099-01-01T00:00:00+08:00 to the restful interface provided by springboot, and stores it in the mysql database
It is found that the database is stored at: 2098-12-31 16:00:00. At this time, the jdbctype of mybatis is not specified, and the default timestamp is used
The time zone is wrong. After confirming the Linux system, there is no problem with the time zone of mysql itself, so it must be a configuration problem.
The Date object used in springboot accepts and prints the output value directly. The time is no problem, so it must be in the part of writing the database.
There is no problem with the configuration of mybatis. It is found that it is the time zone problem of connecting to the database url
serverTimezone=UTC
changed to
serverTimezone=GMT%2B8
Do not use GMT+8, there will be problems with the plus sign
Start the test again, and what is written to the database is expected
Besides reading, what is returned to the front end is 2019-06-04T02:51:31.000+0000, which also needs to be converted to the East Eighth District
The above read from the database has been set, it must be no problem, so it must be in springboot when the object is converted to json
The spring.jackson.time-zone parameter is set to GMT+8, and that's it.