spring - 开发环境中springboot应用程序war文件的上下文根
问题描述
我使用 maven 在 application.properties 中使用以下配置构建了一个 Spring Boot War 文件(WebApplication)。server.servlet.context-path=/app 在开发环境中手动部署Tomcat中的war时,不是读取上下文路径,而是使用war文件的名称作为上下文路径。
战争文件名:AgentApp.0.0.1.SNAPSHOT。
实际网址:http ://dev.com/AgentApp.0.0.1.SNAPSHOT/index.html 。
预期网址:http ://dev.com/app/index.html 。
PS:当从 Eclipse 运行时,这在我的本地环境中运行良好。(不使用嵌入式 tomcat)。
解决方案
我们可以<finalName>
在 pom.xml 中添加标签。当 maven 构建完成时,war/jar 文件将是 finalName 的名称。
推荐阅读
- javascript - 在 React 中使用 setinterval
- wordpress - 关于使用 wordpress 联系表格 7 挂钩的建议
- html - Bootstrap 4:设置列宽固定位置内容的宽度
- sql - 是否可以跨模式从另一个表继承数据?
- linux - 子进程中的清除集
- multithreading - 我正在运行一个 javafx 程序,并且在我期望通常的线程干扰的情况下得到一个 IllegalStateException
- python - 将 N 个项目的所有组合生成到两个袋子中,其中每个项目在一个或零个袋子中
- html - 应用浏览器中的 Instagram 正在转移所有点击事件
- python - 将 MongoDB 查询转换为 JSON
- docusignapi - 尽管已获得同意,Docusign python 示例“CONSENTREQUIRE D”