Akka HTTP:找不到请求的资源

Tha*_*ane 6 java akka-http

我在Akka HTTP 中的第一步使用Akka HTTP“最小示例”

private Route createRoute() {
  return route(
    path("hello", () ->
      get(() ->
        complete("<h1>Say hello to akka-http</h1>"))));
}
Run Code Online (Sandbox Code Playgroud)

现在我想向 my 中添加一个路由resources/web/test.html,类似于“指令”页面上的示例:

private Route createRoute() {
  return route(
    pathSingleSlash(() ->
      getFromResource("web/test.html")
    ),
    path("hello", () ->
      complete("<h1>Say hello to akka-http</h1>")));
}
Run Code Online (Sandbox Code Playgroud)

http://localhost:8080向我展示了以下内容:

The requested resource could not be found.
Run Code Online (Sandbox Code Playgroud)