[英]When Spring Boot app is deployed on tomcat gives 404 error
Spring Boot application runs on embedded tomcat server when run it from Eclipse or intellij idea. 当从Eclipse或intellij idea运行Spring Boot应用程序时,它会在嵌入式tomcat服务器上运行。 But when deployed on external tomcat server it gives 404 error.
但是,当部署在外部tomcat服务器上时,会出现404错误。
Make sure you have done below steps: 确保您已完成以下步骤:
@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>
Paste any specific error in case otherwise,if you still face the issue. 如果仍然遇到问题,请粘贴任何特定的错误,以防万一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.