且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在容器 tomcat 服务器上更改已部署(Spring Boot)war 的上下文路径.所以它不是 demo-0.01-SNAPSHOT

更新时间:2023-09-05 12:58:04

指定应用程序上下文路径的 Spring Boot 属性是:server.contextPath.
但是,您将 WAR 部署到独立的 Tomcat 实例中这一事实不允许使用它.
在此配置中,您不能使用 server.contextPath 和其他特定于容器的属性(例如 server.port).这些旨在与嵌入式 Tomcat 实例配合使用.

The Spring Boot property to specify the context path of the application is : server.contextPath.
But the fact that you are deploying your WAR into a standalone Tomcat instance doesn't allow to use it.
In this configuration, you cannot use server.contextPath and other properties specific to the container (as for example server.port). These are designed to work with the embedded Tomcat instance.

独立的 Tomcat 实例确实保持对 Spring Boot 提供的这些设施的控制.所以必须从独立的Tomcat的配置文件(一般是server.xml或者ROOT.xml的方式)进行配置.

The standalone Tomcat instance keeps indeed the control on these facilities provided by Spring Boot. So you have to configure it from the configuration file of the standalone Tomcat (server.xml or ROOT.xml way generally).