application.yml 1.9 KB

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