application.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Spring Boot 应用配置
  2. spring:
  3. # 应用基本信息
  4. application:
  5. name: base-server
  6. # 数据库配置
  7. datasource:
  8. # H2内存数据库配置(避免文件锁定问题)
  9. url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
  10. driver-class-name: org.h2.Driver
  11. username: sa
  12. password:
  13. # 禁用SQL脚本初始化
  14. sql:
  15. init:
  16. mode: never
  17. # MySQL数据库配置(生产环境用,需要时取消注释)
  18. # url: jdbc:mysql://localhost:3306/base_db?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
  19. # driver-class-name: com.mysql.cj.jdbc.Driver
  20. # username: root
  21. # password: your_password
  22. # JPA配置
  23. jpa:
  24. hibernate:
  25. ddl-auto: update # 自动创建/更新表结构
  26. show-sql: true # 显示SQL语句
  27. properties:
  28. hibernate:
  29. dialect: org.hibernate.dialect.H2Dialect
  30. format_sql: true # 格式化SQL输出
  31. # H2控制台配置(开发时可以访问数据库)
  32. h2:
  33. console:
  34. enabled: true
  35. path: /h2-console
  36. # 开发工具配置
  37. devtools:
  38. restart:
  39. enabled: true
  40. # 文件上传配置
  41. servlet:
  42. multipart:
  43. enabled: true
  44. max-file-size: 10MB
  45. max-request-size: 10MB
  46. file-size-threshold: 2KB
  47. # 服务器配置
  48. server:
  49. port: 8080
  50. address: 0.0.0.0 # 绑定到所有网络接口,允许外部访问
  51. servlet:
  52. context-path: /api # API基础路径
  53. # 日志配置
  54. logging:
  55. level:
  56. com.example.baseserver: DEBUG
  57. org.springframework.web: DEBUG
  58. org.hibernate.SQL: DEBUG
  59. pattern:
  60. console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
  61. # SpringDoc OpenAPI 配置
  62. springdoc:
  63. api-docs:
  64. path: /docs/api-docs
  65. swagger-ui:
  66. path: /docs
  67. operationsSorter: method
  68. tagsSorter: alpha
  69. tryItOutEnabled: true
  70. filter: true
  71. show-actuator: false
  72. # 自定义配置
  73. app:
  74. name: Base Server API
  75. version: 1.0.0
  76. description: Android应用后端API服务
  77. # DeepSeek API配置
  78. deepseek:
  79. api-key: sk-bc62a7031dcb4e40a9ab5545601638cc
  80. base-url: https://api.deepseek.com
  81. model: deepseek-reasoner
  82. max-tokens: 2048
  83. temperature: 0.7
  84. stream: false