赞
踩
记录一下解决方法
首先确保pom.xml文件中有Haikari的坐标
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>8.0.16</version>
- </dependency>
-
- <dependency>
- <groupId>com.zaxxer</groupId>
- <artifactId>HikariCP</artifactId>
- </dependency>
然后启动项目,正常。
执行数据库操作:Hikari - Exception during pool initialization.
哎,肯定是哪配置出问题了,百度了一下,发现是mysql连接的问题,URL连接后面追加 useSSL=false
贴出我的配置
- server:
- port: 8080
- spring:
- datasource:
- url: jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false
- username: root
- password: root
- driver-class-name: com.mysql.cj.jdbc.Driver
- type: com.zaxxer.hikari.HikariDataSource
- hikari:
- minimum-idle: 10
- maximum-pool-size: 50
- auto-commit: true
- idle-timeout: 30000
- pool-name: MyHikari
我的问题解决! 成功取出数据
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。