application-prod.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. server:
  2. port: 8080
  3. servlet:
  4. context-path: /api
  5. spring:
  6. application:
  7. name: payroll-system
  8. # 数据源配置 - 生产环境
  9. datasource:
  10. type: com.alibaba.druid.pool.DruidDataSource
  11. druid:
  12. driver-class-name: com.mysql.cj.jdbc.Driver
  13. # 生产环境数据库地址,需要根据实际情况修改
  14. url: jdbc:mysql://localhost:3306/payroll_system?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
  15. username: root
  16. password: root
  17. # 连接池配置
  18. initial-size: 10
  19. min-idle: 10
  20. max-active: 50
  21. max-wait: 60000
  22. time-between-eviction-runs-millis: 60000
  23. min-evictable-idle-time-millis: 300000
  24. validation-query: SELECT 1
  25. test-while-idle: true
  26. test-on-borrow: false
  27. test-on-return: false
  28. # 生产环境关闭Druid监控
  29. stat-view-servlet:
  30. enabled: false
  31. filter:
  32. stat:
  33. enabled: true
  34. log-slow-sql: true
  35. slow-sql-millis: 2000
  36. # Redis配置 - 生产环境
  37. redis:
  38. host: localhost
  39. port: 6379
  40. password:
  41. database: 0
  42. timeout: 5000
  43. lettuce:
  44. pool:
  45. max-active: 20
  46. max-wait: -1
  47. max-idle: 10
  48. min-idle: 5
  49. # Jackson配置
  50. jackson:
  51. time-zone: GMT+8
  52. date-format: yyyy-MM-dd HH:mm:ss
  53. serialization:
  54. write-dates-as-timestamps: false
  55. # MyBatis Plus配置
  56. mybatis-plus:
  57. mapper-locations: classpath*:/mapper/**/*.xml
  58. type-aliases-package: com.payroll.entity
  59. configuration:
  60. map-underscore-to-camel-case: true
  61. # 生产环境关闭SQL日志
  62. log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
  63. global-config:
  64. db-config:
  65. id-type: auto
  66. logic-delete-field: deleted
  67. logic-delete-value: 1
  68. logic-not-delete-value: 0
  69. # JWT配置
  70. jwt:
  71. secret: payroll-system-secret-key-2024-must-be-at-least-256-bits
  72. expiration: 86400000 # 24小时,单位毫秒
  73. header: Authorization
  74. prefix: Bearer
  75. # 日志配置 - 生产环境
  76. logging:
  77. level:
  78. root: INFO
  79. com.payroll: INFO
  80. com.payroll.mapper: WARN
  81. pattern:
  82. console: '%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n'
  83. file:
  84. name: logs/payroll-system.log
  85. max-size: 100MB
  86. max-history: 30