db-mysql.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # 数据库 配置模板
  2. # 优先从环境变量里取值
  3. shoulder:
  4. database: # 数据库配置请看DatabaseProperties类上的注释
  5. driverClassName: com.mysql.cj.jdbc.Driver
  6. conn-schema: jdbc:mysql
  7. ip: ${MYSQL_IP:127.0.0.1}
  8. port: ${MYSQL_PORT:3306}
  9. username: ${MYSQL_USERNAME:root}
  10. password: ${MYSQL_PWD:root}
  11. addr: ${MYSQL_ADDR:'${shoulder.database.ip}:${shoulder.database.port}'}
  12. database: shoulder_database
  13. # utf8字符集、+8 时区、使用 unicode、关闭 ssl、自动重连、忽略错误的时间(使用null代替)、单次发送多条语句(分号分隔)
  14. conn-param: characterEncoding=utf8&serverTimezone=CTT&useUnicode=true&useSSL=false&autoReconnect=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
  15. url: ${shoulder.database.conn-schema}://${shoulder.database.ip}:${shoulder.database.port}/${shoulder.database.database}?${shoulder.database.conn-param}
  16. bizDatabase: shoulder_base
  17. multiTenantType: SCHEMA
  18. isNotWrite: false
  19. isBlockAttack: false # 是否启用 攻击 SQL 阻断解析器
  20. worker-id: 0
  21. data-center-id: 0
  22. spring:
  23. jpa:
  24. database: MYSQL
  25. hibernate:
  26. #ddl-auto: update
  27. properties:
  28. hibernate:
  29. dialect: org.hibernate.dialect.MySQL8Dialect
  30. show-sql: true
  31. # ============================ 数据库无关的配置 ============================
  32. datasource:
  33. # 多数据源配置
  34. #nameList: beecp
  35. # beecp
  36. type: cn.beecp.BeeDataSource
  37. driverClassName: cn.beecp.BeeDataSource
  38. url: ${shoulder.database.url}
  39. username: ${shoulder.database.username}
  40. password: ${shoulder.database.password}
  41. druid:
  42. username: ${shoulder.database.username}
  43. password: ${shoulder.database.password}
  44. driver-class-name: ${shoulder.database.driverClassName}
  45. url: ${shoulder.database.url}
  46. db-type: mysql
  47. initialSize: 10
  48. minIdle: 10
  49. maxActive: 500
  50. max-wait: 60000
  51. pool-prepared-statements: true
  52. max-pool-prepared-statement-per-connection-size: 20
  53. validation-query: SELECT '1'
  54. test-on-borrow: false
  55. test-on-return: false
  56. test-while-idle: true
  57. time-between-eviction-runs-millis: 60000 #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  58. min-evictable-idle-time-millis: 300000 #配置一个连接在池中最小生存的时间,单位是毫秒
  59. filters: stat,wall
  60. filter:
  61. wall:
  62. enabled: true
  63. config:
  64. commentAllow: true
  65. multiStatementAllow: true
  66. noneBaseStatementAllow: true
  67. web-stat-filter: # WebStatFilter配置,说明请参考Druid Wiki,配置_配置WebStatFilter
  68. enabled: true
  69. url-pattern: /*
  70. exclusions: "*.js , *.gif ,*.jpg ,*.png ,*.css ,*.ico , /druid/*"
  71. session-stat-max-count: 1000
  72. profile-enable: true
  73. session-stat-enable: false
  74. stat-view-servlet: #展示Druid的统计信息,StatViewServlet的用途包括:1.提供监控信息展示的html页面2.提供监控信息的JSON API
  75. enabled: true
  76. url-pattern: /druid/* #根据配置中的url-pattern来访问内置监控页面,如果是上面的配置,内置监控页面的首页是/druid/index.html例如:http://127.0.0.1:9000/druid/index.html
  77. reset-enable: true #允许清空统计数据
  78. login-username: shoulder
  79. login-password: shoulder
  80. mybatis-plus:
  81. mapper-locations:
  82. - classpath*:mapper_**/**/*Mapper.xml
  83. #实体扫描,多个package用逗号或者分号分隔 todo 修改这里
  84. typeAliasesPackage: com.github.shoulder.*.entity;com.github.shoulder.database.mybatis.typehandler
  85. typeEnumsPackage: com.github.shoulder.*.enumeration
  86. global-config:
  87. db-config:
  88. id-type: INPUT
  89. insert-strategy: NOT_NULL
  90. update-strategy: NOT_NULL
  91. select-strategy: NOT_EMPTY
  92. configuration:
  93. #配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId)
  94. map-underscore-to-camel-case: true
  95. cache-enabled: false
  96. #配置JdbcTypeForNull, oracle数据库必须配置
  97. jdbc-type-for-null: 'null'