I am trying to build a SpringBoot application.
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootAppli
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