Unable to start spring boot application

后端 未结 1 672
礼貌的吻别
礼貌的吻别 2020-12-19 06:55

I am unable to start my application using @SpringBootApplication.

@SpringBootApplication
public class AppInitializer extends SpringBootServletInitializer {

         


        
相关标签:
1条回答
  • 2020-12-19 07:12

    Found the problem: The dependency jersey-container-servlet-core is only suitable for servlet containers with less than Servlet 3.0 specification. Since you use Tomcat 7, which implements Servlet 3.0, you have to use jersey-container-servlet. See the Jersey documentation here: https://jersey.java.net/documentation/latest/modules-and-dependencies.html#servlet-app-general

    If you run the application as standalone app (i.e. not deploy it into Tomcat), you have to make sure, that the dependency spring-boot-starter-tomcat is in scope "compile". Currently the dependency has the scope "provided", which means, the dependency is not on the classpath when running the application.

    If you want to run your application both in Tomcat and as standalone app, you have to use Maven profiles and build two WARs, one with spring-boot-starter-tomcat as provided, and one with spring-boot-starter-tomcat as compile.

    0 讨论(0)
提交回复
热议问题