前言:
1.引入maven依赖
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
2.在application.yml写入配置信息
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://127.0.0.1:3306/seckill?serverTimezone=UTC
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
# 下面为连接池设置,应用到上面的数据源中(一些最基本的设置)
#初始大小
initialSize: 5
#最小
minIdle: 5