【问题标题】:Context root of a springboot application war file in dev enviroment开发环境中 Spring Boot 应用程序 War 文件的上下文根
【发布时间】:2019-09-27 19:51:05
【问题描述】:

我使用 Maven 构建了一个 Spring Boot War 文件(WebApplication),并在 application.properties 中进行了以下配置。 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

P.S : 当从 eclipse 运行时,这在我的本地环境中运行良好。(不使用嵌入式 tomcat)。

【问题讨论】:

标签: spring spring-boot tomcat8


【解决方案1】:

我们可以在 pom.xml 中添加<finalName> 标签。当 maven 构建完成时,war/jar 文件将是 finalName 的名称。

【讨论】:

    【解决方案2】:

    您可以在 application.properties 中使用属性 spring.application.name。

    spring.application.name=/app
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-03
      • 2015-11-18
      • 2019-08-13
      • 1970-01-01
      • 2017-04-20
      • 2015-09-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多