• 小白的springboot之路(五)、集成druid


    0-前言

      Druid阿里巴巴开源的一个java数据库连接池,是Java语言中最好的数据库连接池,Druid能够提供强大的监控和扩展功能;集成它能够方便我们对数据库连接进行监控和分析,下面我们来集成它;

    1-集成druid

      集成druid很方便,继续几步即可;

    1-1、添加依赖:

            <!-- 6、集成druid-->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid-spring-boot-starter</artifactId>
                <version>1.1.10</version>
            </dependency>

    1-2、添加配置

    #druid 配置
    spring.application.name=springboot-test-exam1
    spring.datasource.druid.initial-size=5
    spring.datasource.druid.min-idle=5
    spring.datasource.druid.maxActive=20
    spring.datasource.druid.maxWait=60000
    spring.datasource.druid.timeBetweenEvictionRunsMillis=60000
    spring.datasource.druid.minEvictableIdleTimeMillis=300000
    spring.datasource.druid.validationQuery=SELECT 1 FROM DUAL
    spring.datasource.druid.testWhileIdle=true
    spring.datasource.druid.testOnBorrow=false
    spring.datasource.druid.testOnReturn=false
    spring.datasource.druid.poolPreparedStatements=true
    spring.datasource.druid.maxPoolPreparedStatementPerConnectionSize=20
    spring.datasource.druid.filters=stat,wall,slf4j
    spring.datasource.druid.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
    spring.datasource.druid.web-stat-filter.enabled=true
    spring.datasource.druid.web-stat-filter.url-pattern=/*
    spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*
    spring.datasource.druid.stat-view-servlet.url-pattern=/druid/*
    #spring.datasource.druid.stat-view-servlet.allow=127.0.0.1,192.168.163.1
    #spring.datasource.druid.stat-view-servlet.deny=192.168.1.73
    spring.datasource.druid.stat-view-servlet.reset-enable=false
    spring.datasource.druid.stat-view-servlet.login-username=admin
    spring.datasource.druid.stat-view-servlet.login-password=123456

    1-3、运行

      好了,这样就集成了,可以直接运行了,端口/druid就能看到了:

     用自己在配置文件中设置的用户名和密码登录:

     可以看到集成成功了,里面的各种功能等待你去体验和挖掘;至于druid更高级的各种定制功能,我们以后再来聊~好了,本节结束

     源码地址:https://github.com/anson-yang/cloverDemo.git

  • 相关阅读:
    LDAP 总结
    关于OpenLDAPAdmin管理页面提示“This base cannot be created with PLA“问题. Strong Authentication Required问题
    PHP 7.0 5.6 下安裝 phpLDAPadmin 发生错误的修正方法
    ldap、additional info: no global superior knowledge
    ldap安装配置过程中遇到的错误,以及解决方法
    转: LDAP有啥子用? 用户认证
    Mac 安装 brew
    go test 单元函数测试
    haproxy httpcheck with basic auth
    architecture and business process modelling
  • 原文地址:https://www.cnblogs.com/yanghj/p/11465513.html
Copyright © 2020-2023  润新知