spring: datasource: # 默认测试环境使用 H2 MySQL Mode,保证普通 ./mvnw test 不依赖本机 MySQL。 url: "jdbc:h2:mem:th_hotel_test;MODE=MySQL;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE" username: sa password: driver-class-name: org.h2.Driver flyway: enabled: true springdoc: api-docs: enabled: false swagger-ui: enabled: false auth: bootstrap: default-hotel-id: HOTEL-TEST default-hotel-name: 测试酒店 default-hotel-time-zone: Asia/Bangkok --- spring: config: activate: on-profile: test-mysql datasource: # 需要真实 MySQL 集成测试时启用 test,test-mysql profile,并用环境变量覆盖连接信息。 url: "${TH_HOTEL_TEST_DB_URL:jdbc:mysql://127.0.0.1:3306/th_hotel_test?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC}" username: ${TH_HOTEL_TEST_DB_USERNAME:th_hotel_test} password: ${TH_HOTEL_TEST_DB_PASSWORD:} driver-class-name: com.mysql.cj.jdbc.Driver flyway: enabled: true