application.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. server:
  38. port: 8080
  39. servlet:
  40. context-path: /api # API基础路径
  41. # 日志配置
  42. logging:
  43. level:
  44. com.example.baseserver: DEBUG
  45. org.springframework.web: DEBUG
  46. org.hibernate.SQL: DEBUG
  47. pattern:
  48. console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
  49. # SpringDoc OpenAPI 配置
  50. springdoc:
  51. api-docs:
  52. path: /docs/api-docs
  53. swagger-ui:
  54. path: /docs
  55. operationsSorter: method
  56. tagsSorter: alpha
  57. tryItOutEnabled: true
  58. filter: true
  59. show-actuator: false
  60. # 自定义配置
  61. app:
  62. name: Base Server API
  63. version: 1.0.0
  64. description: Android应用后端API服务