Spring boot整合mybatis需要
1.导入整合mybatis依赖
2.添加配置文件
这里使用的是yml格式的配置文件
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ssm_db?serverTimezone=UTC
username: root
password: 1234
在整合的过程中由于Spring boot版本问题导致mysql依赖版本发生变化可以能会发生报错
java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property)
其原因是mysql驱动强制要求设置时区可通过在url后添加serverTimezone=UTC或其他时区来解决此问题 或 修改sql数据库配置