Spring Boot 和 Jboss wildfly 设置上下文根 [英] Spring Boot and Jboss wildfly setting the context root

查看:43
本文介绍了Spring Boot 和 Jboss wildfly 设置上下文根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置 Spring Boot 应用程序的上下文根.我正在将我的应用程序作为 war 文件部署到 Jboss.我试图在将它部署到 JBoss/Wildfly 时设置我希望我的根 URL 的上下文路径,但它似乎被忽略了.除非我添加一个 jboss-web.xml 文件来设置 contex-root 变量,否则我的部署 url 总是基于 war 文件名:

I am trying to set the context root of my spring boot application. I'm deploying my application as a war file to Jboss. i've tried to set the contextPath of what I'd like my root URL to be when deploying it to JBoss/Wildfly but it seems to get ignored. Unless I add a jboss-web.xml file setting a contex-root variable, my deployment url is always based on the war file name:

例如: myapp.war 总是部署为 : localhost:8080/myapp 除非我使用 jboss-web.我已经尝试在 server.properties 文件中设置 contextPath,但它似乎不起作用.

e.g. : myapp.war always deploys as : localhost:8080/myapp unless I use jboss-web. I've tried setting the contextPath in the server.properties file and it doesn't seem to work.

我的问题是我应该可以吗?我正在使用最新的 Spring Boot.

My question is should I be able to? I'm using the latest Spring Boot.

推荐答案

换句话说,添加你的 jboss-web.xml

此目录下的文件:/src/main/webapp/WEB-INF

jboss-web.xml 的内容

Content of your jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
        <context-root>/</context-root>
</jboss-web>

这篇关于Spring Boot 和 Jboss wildfly 设置上下文根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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