静态内容页面在kubernets集群中部署的springboot应用程序中不起作用

时间:2019-07-11 15:44:10

标签: java spring-boot kubernetes

我的spring boot应用程序有一个简单的静态html文件,保存在src / main / resources / static / index.html中,并且添加了一个额外的控制器来返回此视图。

public class HomeController {

    @RequestMapping(path = "${url_prefix}/")
    private String home() {
        return "index.html";
    }

}

在我的本地计算机上,部署http://localhost:8080/导航到index.html。

然后将相同的应用程序部署到kubernettes集群中,其中 如果导航到该页面,则返回

  

Whitelabel错误页面

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Jul 11 15:32:14 GMT 2019
There was an unexpected error (type=Not Found, status=404).
No message available

我检查了已部署的spring boot jar的内容,并且可以看到该jar中的index.html。

  9213 Thu Jul 11 17:10:08 CEST 2019 BOOT-INF/classes/static/index.html

我没有太多有关kubernettes集群配置的信息。我非常了解,没有太多有关部署方案的信息,没有人可以真正帮助我。

但是可以请一些人从更高的角度阐明一些信息(我知道404错误的含义)。

0 个答案:

没有答案
相关问题