Files
Jiscuss/src/main/resources/application-h2.yml
T
2026-04-30 16:27:58 +08:00

62 lines
2.2 KiB
YAML

# ─────────────────────────────────────────────────────────────────────────────
# H2 / development profile.
# Activate with: --spring.profiles.active=h2
# ─────────────────────────────────────────────────────────────────────────────
spring:
jpa:
show-sql: true
# Flyway owns DDL; Hibernate only validates existing schema
hibernate:
ddl-auto: validate
# H2 uses the same SQL dialect as MySQL in MySQL compatibility mode
# H2 console — enabled in dev ONLY.
# Access restricted to ROLE_ADMIN via Spring Security (see WebSecurityConfig).
# web-allow-others=false prevents remote access; rely on security for protection-in-depth.
h2:
console:
path: /h2-console
# Default OFF — enable explicitly at startup: --spring.h2.console.enabled=true
enabled: false
settings:
web-allow-others: false
datasource:
url: jdbc:h2:~/testjiscuss;MODE=MySQL;NON_KEYWORDS=VALUE
username: sa
password:
driver-class-name: org.h2.Driver
type: com.alibaba.druid.pool.DruidDataSource
druid:
min-idle: 1
initial-size: 2
max-active: 5
max-wait: 3000
validation-query: SELECT 1
filter:
stat:
enabled: true
db-type: h2
log-slow-sql: true
slow-sql-millis: 1000
web-stat-filter:
enabled: true
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
stat-view-servlet:
enabled: true
url-pattern: /druid/*
# Druid UI gated by Spring Security ROLE_ADMIN; built-in basic auth disabled
reset-enable: false
allow: 127.0.0.1
# Flyway: run V1 + V2 migrations on H2 in-memory DB on startup
flyway:
locations: classpath:db/migration
url: ${spring.datasource.url}
user: ${spring.datasource.username}
password: ${spring.datasource.password}
# Override default port for dev profile
server:
port: 80