application.yml:
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:file:../app-db/app_db;AUTO_SERVER=TRUE
username: sa
password: sa
initialize: false
jpa:
hibernate:
ddl-auto: validate
show-sql: true
database-platform: org.hibernate.dialect.H2Dialect
h2:
console:
enabled: true
settings:
web-allow-others: true
allowed:
resources: /h2-console/**
我甚至明确允许/h2-console/**
httpSecurity.authorizeRequests()
.antMatchers(allowedResources)
.permitAll()
当我尝试访问localhost:8080/h2-console
时,一直出现403错误。
我尝试了很多设置,还尝试添加以下内容:
management.security.enabled=true
security.basic.enabled=true
但是我无法访问h2控制台。