在容器 tomcat 服务器上更改已部署(Spring Boot)war 的上下文路径.所以它不是 demo-0.01-SNAPSHOT [英] Changing the context path of deployed (Spring Boot) war on a container tomcat server. So it is not demo-0.01-SNAPSHOT

查看:26
本文介绍了在容器 tomcat 服务器上更改已部署(Spring Boot)war 的上下文路径.所以它不是 demo-0.01-SNAPSHOT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用许多配置来部署我的站点,以使其与正在部署的战争名称不同.有没有办法轻松做到这一点.部署将部署到位于其他地方的 tomcat.例如比特纳米实例

I have tried to deploy my site using many configurations to make it change from the war name being deployed. Is there a way to do this easily. The deployment will to a tomcat sitting somewhere else. e.g. bitnami instance

我在 application.properties 中尝试了各种设置组合,但没有任何区别:

I have tried various combinations of settings in the application.properties but none make any difference:

 server.servlet.context-path=/a
    server.servlet.path=/b
    spring.webservices.path=/c
    server.contextPath=/m

war 被称为 demo-0.0.01-SNAPSHOT.war,当放入 webapps 目录时,它会创建相同的命名目录,然后该站点有一个/demo-0.0.01-SNAPSHOT 路径.我认为在 Spring Boot 的时代,这现在很容易,但像我这样的傻瓜还没有解决.还是人们只是使用 tomcats 部署嵌入式版本并在现在运行它们?

The war is called demo-0.0.01-SNAPSHOT.war and when dropped in the webapps directory it creates the same named directory and the site then has a /demo-0.0.01-SNAPSHOT path. I thought with the days of Spring Boot this would be easy now but a fool like me hasn't worked it out yet. Or do people just deploy embedded versions with tomcats and run them nowadays?

(顺便说一句,我也试过 root.xml,没有运气......除非我在我的 Windows 机器上做错了,首先在我的开发机器上测试,用于部署的 linux)

(BTW I have tried the root.xml as well, no luck ... unless i did it wrong on my windows box, testing on my dev box first, linux for deployment)

任何帮助将不胜感激.

谢谢

推荐答案

指定应用程序上下文路径的 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).

这篇关于在容器 tomcat 服务器上更改已部署(Spring Boot)war 的上下文路径.所以它不是 demo-0.01-SNAPSHOT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆