Giter VIP home page Giter VIP logo

Comments (4)

randeexiong avatar randeexiong commented on August 15, 2024

druid 配置信息

spring:    
  #druid数据源连接池
  datasource:
    druid:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://localhost:3306/api-boot-admin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
      username: root
      password: root
      type: com.alibaba.druid.pool.DruidDataSource  #明确指明使用druid

      initialSize: 5
      minIdle: 5
      maxActive: 20
      maxWait: 60000
      timeBetweenEvictionRunsMillis: 60000
      minEvictableIdleTimeMillis: 300000
      validationQuery: SELECT 1 FROM DUAL
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      #   配置监控统计拦截的filters,stat:监控统计、Log4j:日志记录、wall:防御sql注入
      # filters: stat,wall,log4j
      maxPoolPreparedStatementPerConnectionSize: 20
      useGlobalDataSourceStat: true
      connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
        # 通过 connection-properties 属性打开 mergeSql 功能;慢 SQL 记录
      filter:
        wall:
          enabled: true
        stat:
          enabled: true
          log-slow-sql: true
          slow-sql-millis: 10000
          merge-sql: true
        # 配置 DruidStatFilter
      web-stat-filter:
        enabled: true
        url-pattern: /*
        session-stat-enable: true
        profile-enable: true
        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
      # 配置 DruidStatViewServlet
      stat-view-servlet:
        enabled: true
        # IP 白名单,没有配置或者为空,则允许所有访问
        allow:
        # IP 黑名单,若白名单也存在,则优先使用
        deny:
        # 禁用 HTML 中 Reset All 按钮
        reset-enable: false
        # 登录用户名/密码
        login-username: root
        login-password: 123
      aop-patterns: com.druid.*

from api-boot.

hengboy avatar hengboy commented on August 15, 2024

@randeexiong 是不是配置用户名密码的方式不太对,如果没有引入security依赖,apiboot不会限制登录路径,而且那个登录地址也是druid提供的

from api-boot.

randeexiong avatar randeexiong commented on August 15, 2024

同样的配置,用 druid-spring-boot-starterspring-boot-starter-web 是可以正常进入druid的监控界面的

from api-boot.

hengboy avatar hengboy commented on August 15, 2024

可以访问http://localhost:8080/druid/index.html

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.minbox.framework</groupId>
            <artifactId>api-boot-starter-mybatis-enhance</artifactId>
        </dependency>
        <dependency>
            <groupId>org.minbox.framework</groupId>
            <artifactId>api-boot-starter-ssh-agent</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.2.11</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.minbox.framework</groupId>
                <artifactId>api-boot-dependencies</artifactId>
                <version>2.3.8</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
spring:
  datasource:
    url: jdbc:mariadb://127.0.0.1/metadata?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&allowPublicKeyRetrieval=true
    username: developer
    password: iamadeveloper
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      filter:
        wall:
          enabled: true
        stat:
          enabled: true
          log-slow-sql: true
          slow-sql-millis: 10000
          merge-sql: true
        # 配置 DruidStatFilter
      web-stat-filter:
        enabled: true
        url-pattern: /*
        session-stat-enable: true
        profile-enable: true
        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
      # 配置 DruidStatViewServlet
      stat-view-servlet:
        enabled: true
        # IP 白名单,没有配置或者为空,则允许所有访问
        allow:
        # IP 黑名单,若白名单也存在,则优先使用
        deny:
        # 禁用 HTML 中 Reset All 按钮
        reset-enable: false
        # 登录用户名/密码
        login-username: root
        login-password: 123

from api-boot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.