【发布时间】:2018-08-24 14:19:27
【问题描述】:
当从 Eclipse 或 intellij idea 运行时,Spring Boot 应用程序在嵌入式 tomcat 服务器上运行。但是当部署在外部 tomcat 服务器上时,它会给出 404 错误。
【问题讨论】:
标签: java spring tomcat http-status-code-404
当从 Eclipse 或 intellij idea 运行时,Spring Boot 应用程序在嵌入式 tomcat 服务器上运行。但是当部署在外部 tomcat 服务器上时,它会给出 404 错误。
【问题讨论】:
标签: java spring tomcat http-status-code-404
确保您已完成以下步骤:
@SpringBootApplication public class SpringBootWebApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(SpringBootWebApplication.class); } public static void main(String[] args) throws Exception { SpringApplication.run(SpringBootWebApplication.class, args); } }
<!-- marked the embedded servlet container as provided --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
<packaging>war</packaging>
如果您仍然遇到问题,请粘贴任何特定错误以防万一。
【讨论】: