12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- # Spring Boot 应用配置
- spring:
- # 应用基本信息
- application:
- name: base-server
-
- # 数据库配置
- datasource:
- # H2文件数据库配置(持久化存储)
- url: jdbc:h2:file:./data/testdb
- driver-class-name: org.h2.Driver
- username: sa
- password:
-
- # MySQL数据库配置(生产环境用,需要时取消注释)
- # url: jdbc:mysql://localhost:3306/base_db?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
- # driver-class-name: com.mysql.cj.jdbc.Driver
- # username: root
- # password: your_password
-
- # JPA配置
- jpa:
- hibernate:
- ddl-auto: update # 自动创建/更新表结构
- show-sql: true # 显示SQL语句
- properties:
- hibernate:
- dialect: org.hibernate.dialect.H2Dialect
- format_sql: true # 格式化SQL输出
-
- # H2控制台配置(开发时可以访问数据库)
- h2:
- console:
- enabled: true
- path: /h2-console
-
- # 开发工具配置
- devtools:
- restart:
- enabled: true
- # 服务器配置
- server:
- port: 8080
- servlet:
- context-path: /api # API基础路径
- # 日志配置
- logging:
- level:
- com.example.baseserver: DEBUG
- org.springframework.web: DEBUG
- org.hibernate.SQL: DEBUG
- pattern:
- console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
- # SpringDoc OpenAPI 配置
- springdoc:
- api-docs:
- path: /docs/api-docs
- swagger-ui:
- path: /docs
- operationsSorter: method
- tagsSorter: alpha
- tryItOutEnabled: true
- filter: true
- show-actuator: false
- # 自定义配置
- app:
- name: Base Server API
- version: 1.0.0
- description: Android应用后端API服务
|