Spring Boot应用程序在从Eclipse或intellij构思运行时在嵌入式tomcat服务器上运行。但是当部署在外部tomcat服务器上时,它会产生404错误。
答案 0 :(得分:3)
确保您已完成以下步骤:
@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>
如果您仍然遇到问题,请粘贴任何特定错误。