我正在研究 SpringBoot api 并使用具有以下属性设置的 H2 数据库。
spring.h2.console.enabled=true
spring.datasource.name=test
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.datasource.initialization-mode = embedded
spring.datasource.url=jdbc:h2:mem:test
spring.jpa.hibernate.ddl-auto = update
当我想使用浏览器通过'查看H2数据库控制台时http://localhost:8082/h2-console http://localhost:8082/h2-console',在浏览器中打开一个屏幕,其中包含连接和测试连接按钮。当我单击“测试连接”时,它返回成功,但是当单击“连接”按钮时,出现错误,本地主机拒绝连接。
在你的 spring 安全文件中添加这两行就可以了。
http.csrf().disable();
http.headers().frameOptions().disable();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)