springboot笔记示例三:集成druid正确姿势
·
springboot笔记示例三:集成druid
pom.xml添加依赖
<!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
yml配置
spring:
datasource:
druid:
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #druid不统计这些请求数据
stat-view-servlet:
enabled: true #页面视图为true就是开启
login-username: root
login-password: root
# IP白名单 (没有配置或者为空,则允许所有访问)
#allow: 127.0.0.1,192.168.163.1
# IP黑名单 (存在共同时,deny优先于allow)
#deny: 192.168.10.1
dynamic:
primary: ck
strict: false
datasource:
mysql:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: b3tx@4!yJ^fDXaQv
url: jdbc:mysql://10.64.9.9:9558/yding_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
type: com.alibaba.druid.pool.DruidDataSource
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
filters: stat,log4j
ck:
driver-class-name: ru.yandex.clickhouse.ClickHouseDriver
url: jdbc:clickhouse://10.64.9.9:9556/default
username: default
password: kBQf^5taQ!ZfWbZf
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
filters: stat,log4j
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
typeAliasesPackage: com.nit.clickhouse.entity
global-config:
db-config:
id-type: assign_uuid
table-underline: true
configuration:
map-underscore-to-camel-case: true
druid使用
http://localhost:8080/druid/
#账号:yml.login-username配置的root
更多推荐
所有评论(0)