在tomcat上部署spring boot war时要注意这一点。 任何人都收到此错误 我有以下步骤:
Pom.xml: org.springframework.boot 弹簧启动启动器网站 org.springframework.boot 弹簧启动启动器tomcat
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
主类:
@SpringBootApplication
public class MainApp extends SpringBootServletInitializer{
@Override
protected SpringApplicationBuilder configure (SpringApplicationBuilder builder) {
return builder.sources(MainApp.class);
}
public static void main(String[] args) {
SpringApplication.run(MainApp.class, args);
}
}