4ae0e8d125
问题: - 后端服务使用H2内存数据库 - Flyway被禁用,导致数据库初始化脚本未运行 - admin用户不存在,登录API返回401错误 修复: - 启用Flyway(flyway.enabled: true) - 指定迁移脚本位置(locations: classpath:db/migration) - 启用基线迁移(baseline-on-migrate: true) 预期效果: - 数据库初始化脚本自动运行 - admin用户自动创建 - 登录API正常工作
68 lines
1.4 KiB
YAML
68 lines
1.4 KiB
YAML
server:
|
|
port: 8084
|
|
|
|
spring:
|
|
application:
|
|
name: manage-app
|
|
r2dbc:
|
|
url: r2dbc:h2:mem:///testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
|
|
username: sa
|
|
password:
|
|
pool:
|
|
initial-size: 5
|
|
max-size: 20
|
|
max-idle-time: 30m
|
|
max-life-time: 1h
|
|
acquire-timeout: 5s
|
|
datasource:
|
|
url: jdbc:h2:mem:///testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
|
|
username: sa
|
|
password:
|
|
driver-class-name: org.h2.Driver
|
|
flyway:
|
|
enabled: true
|
|
locations: classpath:db/migration
|
|
baseline-on-migrate: true
|
|
h2:
|
|
console:
|
|
enabled: true
|
|
path: /h2-console
|
|
security:
|
|
user:
|
|
name: disabled
|
|
password: disabled
|
|
|
|
management:
|
|
endpoints:
|
|
web:
|
|
exposure:
|
|
include: health,info,metrics,env,loggers
|
|
base-path: /actuator
|
|
endpoint:
|
|
health:
|
|
show-details: always
|
|
metrics:
|
|
tags:
|
|
application: ${spring.application.name}
|
|
environment: ${spring.profiles.active}
|
|
|
|
logging:
|
|
level:
|
|
cn.novalon.manage: DEBUG
|
|
org.springframework.r2dbc: DEBUG
|
|
cn.novalon.manage.db: DEBUG
|
|
org.flywaydb: INFO
|
|
|
|
springdoc:
|
|
api-docs:
|
|
path: /api-docs
|
|
enabled: true
|
|
swagger-ui:
|
|
path: /swagger-ui.html
|
|
enabled: true
|
|
tags-sorter: alpha
|
|
operations-sorter: alpha
|
|
show-actuator: false
|
|
default-consumes-media-type: application/json
|
|
default-produces-media-type: application/json
|