| # 测试环境配置 |
| spring: |
| application: |
| name: PTPlatform-test # 区分测试环境 |
| |
| spring: |
| sql: |
| init: |
| mode: always # 一定要始终执行,不论你用的是哪个 profile |
| schema-locations: classpath:schema.sql |
| |
| |
| # 数据源配置 (H2 内存数据库) |
| datasource: |
| url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MODE=MYSQL # 模拟MySQL语法 |
| driver-class-name: org.h2.Driver |
| username: sa |
| password: |
| |
| # JPA/Hibernate 配置 |
| jpa: |
| hibernate: |
| ddl-auto: update # 自动更新表结构 |
| show-sql: true # 显示SQL日志 |
| properties: |
| hibernate: |
| dialect: org.hibernate.dialect.H2Dialect |
| format_sql: true |
| |
| # 关闭开发工具(测试环境不需要热部署) |
| devtools: |
| restart: |
| enabled: false |
| sql: |
| init: |
| platform: h2 |
| |
| # MyBatis-Plus 测试配置 |
| mybatis-plus: |
| configuration: |
| log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 输出SQL日志 |
| mapper-locations: classpath:/mapper/*.xml |
| type-aliases-package: com.example.demo.model |
| |
| # 测试专用端口 |
| server: |
| port: 0 # 随机端口,避免冲突 |