Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]

前端 未结 5 915
孤独总比滥情好
孤独总比滥情好 2021-02-14 15:32

I am trying to build a SpringBoot application.

 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootAppli         


        
5条回答
  •  眼角桃花
    2021-02-14 15:46

    My guess is you have to use the default ServletInitializer class that is provided within the Spring Boot Project template of Eclipse.

    //SpringBootApplication.java
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    public class SpringBootApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(SpringBootApplication.class, args);
        }
    }
    
    //ServletInitializer.java
    public class ServletInitializer extends SpringBootServletInitializer {
    
        @Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
            return application.sources(SpringBootApplication.class);
        }
    
    }
    

    If you are not using ServletInitializer class as specified in Spring Boot Starter Project template, try to extend SpringBootServletInitializer from your App class

    public class App extends SpringBootServletInitializer
    

    Please check a similar answer here

提交回复
热议问题