【问题标题】:Deploy as ROOT in embedded tomcat在嵌入式 tomcat 中部署为 ROOT
【发布时间】:2018-12-30 08:58:47
【问题描述】:

我有一个名为 my-app 的 Spring Boot 应用程序。我可以将它打包为一个战争,将战争作为 ROOT.war 部署到外部 tomcat 服务器,然后从localhost:8080 访问它。但是现在如果我使用 Run As > Run On Server 从 Spring Tool Suite 运行此应用程序,则可以从 localhost:8080/my-app 访问该应用程序。

我怎样才能从localhost:8080 访问它?

【问题讨论】:

  • @Nikhil 我不认为该链接说明了有关嵌入式 tomcat 的任何内容。如何编辑嵌入式tomcat的server.xml?
  • 当您使用Run As > Run On Server 部署spring boot 时,您没有使用嵌入式tomcat。
  • 啊,错过了你正在使用 STS,在这种情况下这个问题帮助:stackoverflow.com/questions/12305077/…
  • @SagarRohankar 哇。我今天学到了一些新东西。谢谢:)

标签: java spring-boot tomcat spring-tool-suite


【解决方案1】:

application.properties中的context-path改成/,比如

server.servlet.context-path=/

更多选项:https://www.baeldung.com/spring-boot-context-path

【讨论】:

  • 您使用的是哪个版本的引导,1 还是 2?
  • 我使用的是 2.1.0.RELEASE 版本
猜你喜欢
  • 2018-10-28
  • 1970-01-01
  • 1970-01-01
  • 2011-09-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多