Hi, I have run into following issue after updating spring boot from 2.2.6 to 2.2.7:
When I save LocalDate
with spring data jpa repository to mysql - for example:
2020-05-08
, it is correctly written to database as 2020-05-08
.
But when I later want to retrieve it with the repository what I get back is shifted by one day backwards:
2020-05-07
. This started to happen only after this update.
I made sure that the database is set to UTC:
And I also set the application to the same timezone:
@ConfigurationPropertiesScan
@EnableScheduling
@SpringBootApplication
class EconomyApplication {
@PostConstruct
fun init() {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"))
}
}
This problem is also described previously by someone on stackoverflow
Comment From: snicoll
@Ejstn I am afraid there is nothing we can do about that. Spring Boot 2.2.7
upgraded to a new version of the mysql driver. Please try to downgrade to 8.0.19
and see if that makes any difference.
Comment From: cetonek
@snicoll Thank you, you are right. I downgraded mysql connector to 8.0.19 and I dont get this issue. I will try to raise this issue to mysql connector maintainers: https://bugs.mysql.com/bug.php?id=99487
Comment From: snicoll
Thanks for the follow up