用IDEA 使用最新的springboot版本搭建应用时,pom.xml部分依赖如下:
代码语言:javascript复制 <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
......
<!--mysql jdbc 连接驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
我们看到的是mysql连接器版本是:mysql-connector-java-8.0.13.jar。 启动服务运行时发下如下异常:
java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one time
需要指定时区: ?serverTimezone=GMT+8
即可GMT+8代表: 东八区
spring:
application:
name: cruncher
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/spCloudDb
改为:
代码语言:javascript复制spring:
application:
name: cruncher
datasource:
driverClassName: com.mysql.jdbc.Driver
url: "jdbc:mysql://localhost:3306/spCloudDb?serverTimezone=GMT+8"