第一个问题:
以下是报错内容:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is 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) to use a more specifc time zone value if you want to utilize time zone support. ### The error may exist in com/czxy/mapper/OrderMapper.java (best guess) ### The error may involve com.czxy.mapper.OrderMapper.selectById ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is 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) to use a more specifc time zone value if you want to utilize time zone support.
时区设置问题,解决办法:
只需要在德鲁伊连接池中加入时区设置,加上以下时区,或者是其他需要的时区即可
&serverTimezone=Asia/Shanghai
第二个问题:
以下是报错内容
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
提示信息表明:
数据库驱动com.mysql.jdbc.Driver已经被弃用了、应当使用新的驱动com.mysql.cj.jdbc.Driver
所以,按照提示更改jdbc.properties配置 com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver
报错即可解决