阿里数据源配置

application.yml

# Tomcat
server:
  tomcat:
    uri-encoding: UTF-8
    max-threads: 1000
    min-spare-threads: 30
  port: 80
  servlet:
    context-path: /pay

# 系统自定义全局配置,可根据实际需要扩展使用
global:
#  upload-location: D://Program Files//project//dp-boot// #文件上传目录
  upload-mapping: /upload/ #文件上传目录访问路径
  redis-session-dao: false #是否使用使用redis会话管理器,true为开启,false为关闭
  kaptcha-enable: false #是否开启验证码,true为开启,false为关闭


# jwt配置
#jwt:
#  secret: dp  #jwt密钥
#  expiration: 604800  #过期时间,秒

spring:
  # 环境 sit:集成测试环境|pre:预生产环境|prd:生成环境
  profiles:
    active: sit
  mvc:
    static-path-pattern: /static/**
  # jackson时间格式化
  jackson:
    time-zone: GMT+8
    date-format: yyyy-MM-dd HH:mm:ss
  servlet:
    multipart:
      max-file-size: 100MB
      max-request-size: 100MB
      enabled: true

# Mybatis配置
mybatis:
  configLocation: classpath:config.xml
  typeAliasesPackage: com.zmt.pay.entity
  mapperLocations: classpath:mappers/*.xml #注意:一定要对应mapper映射xml文件的所在路径

application-sit.yml 配置

spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driverClassName: com.mysql.jdbc.Driver
    druid:
      master-data-source:  #主库数据源
        url: jdbc:mysql://127.0.0.1:3306/pay?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
        username: root
        password: test
      slave-data-source:  #从库数据源
        url: jdbc:mysql://127.0.0.1:3306/pay?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
        username: root
        password: test
      initial-size: 10
      max-active: 100
      min-idle: 10
      max-wait: 60000
      pool-prepared-statements: true
      max-pool-prepared-statement-per-connection-size: 20
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
      validation-query: SELECT 1 FROM DUAL
      test-while-idle: true
      test-on-borrow: false
      test-on-return: false
      stat-view-servlet:
        enabled: true
        url-pattern: /druid/*
        #login-username: admin
        #login-password: admin
      filter:
        stat:
          log-slow-sql: true
          slow-sql-millis: 1000
          merge-sql: true
        wall:
          config:
            multi-statement-allow: true
  reids:
    host: 127.0.0.1
    port: 6379
    password:
    database: 0
    timeout: 1000
    jedis:
      pool:
        max-active: 6000
        max-wait: 1000
        max-idle: 400

源代码请参考:https://github.com/18772101110/pay_Summary/

或者:基础版本  https://download.csdn.net/download/qq_16393511/10962594

你可能感兴趣的:(SpringBoot)