整合druid连接池

今天主要是想要搭建一个基于连接池mysql连接, 不过用的不是原生态的druid连接方式, 原生的那种配置多数据源说不定还挺方便的

       
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            1.3.2
        
        
        
            mysql
            mysql-connector-java
            8.0.19
        
        
            com.alibaba
            druid-spring-boot-starter
            1.1.17
        

server:
  port: 9100
spring:
  cloud:
    gateway:
      enabled: true
      httpclient:
        connect-timeout: 300000

  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    druid:
      initial-size: 5
      max-active: 20
      max-evictable-idle-time-millis: 60000
      max-wait: 60000
      min-evictable-idle-time-millis: 30000
      min-idle: 5
      password: password
      test-on-borrow: false
      test-while-idle: true
      time-between-eviction-runs-millis: 60000
      url: jdbc:mysql://ip:端口/xxx?characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useUnicode=true
      username: root
      validation-query: SELECT 1


  application:
    name: xxxx

mybatis:
  # mapper-locations: classpath:mybatis/mapper/**/*Mapper.xml
  configuration:
    call-setters-on-nulls: true
    map-underscore-to-camel-case: true
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

然后就可以正常使用了

你可能感兴趣的:(整合druid连接池)