This commit is contained in:
2026-04-29 19:04:48 +08:00
parent 543c4d9096
commit ac6442a452
43 changed files with 1104 additions and 489 deletions
+40 -54
View File
@@ -1,76 +1,62 @@
#h2 配置
# ─────────────────────────────────────────────────────────────────────────────
# H2 / development profile.
# Activate with: --spring.profiles.active=h2
# ─────────────────────────────────────────────────────────────────────────────
spring:
cache:
type: ehcache
ehcache:
config: classpath:ehcache.xml
jpa:
generate-ddl: false
show-sql: true
# Flyway owns DDL; Hibernate only validates existing schema
hibernate:
ddl-auto: none
ddl-auto: validate
# H2 uses the same SQL dialect as MySQL in MySQL compatibility mode
database-platform: org.hibernate.dialect.H2Dialect
# 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
enabled: true
# Default OFF — enable explicitly at startup: --spring.h2.console.enabled=true
enabled: false
settings:
web-allow-others: true
web-allow-others: false
datasource:
platform: h2
url: jdbc:h2:~/testjiscuss
url: jdbc:h2:~/testjiscuss;MODE=MySQL;NON_KEYWORDS=VALUE
username: sa
password:
schema: classpath:schema.sql
data: classpath:data.sql
driver-class-name: org.h2.Driver
type: com.alibaba.druid.pool.DruidDataSource
druid:
min-idle: 2
initial-size: 5
max-active: 10
max-wait: 5000
validation-query: select 1SS
# 状态监控
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: 2000
# 监控过滤器
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/*"
# druid 监控页面
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
stat-view-servlet:
enabled: true
url-pattern: /druid/*
# reset-enable: false
# login-username: root
# login-password: root
freemarker:
# 设置模板后缀名
suffix: .ftl
# 设置文档类型
content-type: text/html
# 设置页面编码格式
charset: UTF-8
# 设置页面缓存
cache: false
# 设置ftl文件路径
template-loader-path:
- classpath:/templates
settings:
classic_compatible: true
# 设置静态文件路径,js,css等
mvc:
static-path-pattern: /static/**
server:
# Druid's own login — change before deploying to any shared environment
reset-enable: false
login-username: admin
login-password: changeme_dev
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}
port: 80