pac*_*low 38 java h2 spring-boot
我正在使用Spring Boot 1.4.1和H2数据库.我通过在application.properties文件中添加以下行来启用H2控制台,如参考指南中所述:
spring.h2.console.enabled=true
spring.h2.console.path=/h2
Run Code Online (Sandbox Code Playgroud)
当我在Chrome 53 for Windows中进入H2控制台时,我可以看到登录页面并单击"测试连接"按钮导致"测试成功":
但是当我点击"连接"按钮时,屏幕变成完全空白.当我查看源代码时,我看到"抱歉,Lynx尚未支持"(请参阅完整源代码).在Firefox中也会发生同样的事情.
为什么会这样?我相信我正在使用正确的JDBC URL,因为有4个不同的人发布了您应该使用的这个问题jdbc:h2:mem:testdb.
pac*_*low 74
根据博客文章,如果项目中具有依赖项,则需要将一行添加到类的configure方法中,否则在登录H2控制台后将看到一个空页:SecurityConfigspring-boot-starter-security
http.headers().frameOptions().disable();
Run Code Online (Sandbox Code Playgroud)
我添加了该行,它解决了问题.
可替代地,下面的行,可以使用(如所提到的在这里):
http.headers().frameOptions().sameOrigin();
Run Code Online (Sandbox Code Playgroud)
我可以在SecurityConfig类中使用以下代码解决相同的问题
@Override
protected void configure(HttpSecurity http) throws Exception {
bla();
bla();
http.headers().frameOptions().sameOrigin();
}
Run Code Online (Sandbox Code Playgroud)
我不知道这条线是做什么的,也许有更多经验的人可以解释它。
| 归档时间: |
|
| 查看次数: |
11805 次 |
| 最近记录: |