解决方法:
方案一:配置文件中加入serverTimezone=GMT%2B8
spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
方案二:设置数据库
show variables like '%time_zone%';
set global time_zone='+8:00';