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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

逆天-逍遥哥哥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值