java - 无法使用来自 Jhipster 的给定路由连接到 H2 数据库
问题描述
我有一个运行 H2 数据库的 Java Spring 项目,在运行它mvnw
并转到 http://localhost:8080/h2-console 后,我看到了上面的图像。
我团队中的其他人说这对他们来说效果很好,而且我们在同一个代码仓库和 master 上。
我在 Chrome、Edge 和 Firefox 中尝试过,结果相同。我还仔细检查了 JavaScript 是否已打开并正常工作。
唯一记录到控制台的是当我将 spring 安全日志设置为 DEBUG 时,然后显示如下:
----------------------------------------------------------
2020-10-19 16:14:18.376 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Request 'GET /h2-console/login.jsp' doesn't match 'OPTIONS /*
*'
2020-10-19 16:14:18.376 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/h2-console/login.jsp'; against
'/app/**/*.{js,html}'
2020-10-19 16:14:18.376 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/h2-console/login.jsp'; against
'/i18n/**'
2020-10-19 16:14:18.377 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/h2-console/login.jsp'; against
'/content/**'
2020-10-19 16:14:18.377 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/h2-console/login.jsp'; against
'/h2-console/**'
2020-10-19 16:14:18.377 DEBUG 13932 --- [ XNIO-1 task-1] o.s.security.web.FilterChainProxy : /h2-console/login.jsp has an empty filter list
2020-10-19 16:14:18.409 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Request 'GET /h2-console/stylesheet.css' doesn't match 'OPTIO
NS /**'
2020-10-19 16:14:18.409 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/h2-console/stylesheet.css'; aga
inst '/app/**/*.{js,html}'
2020-10-19 16:14:18.409 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/h2-console/stylesheet.css'; aga
inst '/i18n/**'
2020-10-19 16:14:18.409 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/h2-console/stylesheet.css'; aga
inst '/content/**'
2020-10-19 16:14:18.409 DEBUG 13932 --- [ XNIO-1 task-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/h2-console/stylesheet.css'; aga
inst '/h2-console/**'
2020-10-19 16:14:18.410 DEBUG 13932 --- [ XNIO-1 task-1] o.s.security.web.FilterChainProxy : /h2-console/stylesheet.css has an empty filter list
这可能是什么原因?
谢谢!
解决方案
将不安全的内联添加到代码中,您可以在其中设置 CSP 标头