问题背景:springboot整合mybatis,前端发送请求后,后端报错如下:
报错:
- ERROR 15516 --- [nio-8080-exec-1] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
- The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone.
- Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
解决方案:
在application.yml的数据库配置的url中,加入时区配置serverTimezone=UTC
完整代码如下:
spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/campus_help? useUnicode=true&characterEncoding=utf8&serverTimezone=UTC username: root password: root
本人211软件工程大二在读,喜欢做些项目比赛,如果对你有所帮助,那就太好啦!
感谢你的支持!