Spring Boot: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

前端 未结 27 1454
一整个雨季
一整个雨季 2020-11-28 03:55

I am totally new to Spring and started to do the official guides from this site: https://spring.io/guides

I\'d like to do this guide: https://spring.io/guides/gs/sch

27条回答
  •  忘掉有多难
    2020-11-28 04:36

    If you run it successfully using command line gradle bootRun, while packaging it with command line gradle jar to jar file in order to run it with command line java -jar build/libs/demo.jar, unfortunately, it failed with Exception: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean, in this case, you need to use task bootRepackage of gradle plugin spring-boot to generate special runnable jar.

    • setup 1

      $ gradle clean bootRepackage

    • setup 2

      $ java -jar build/libs/demo.jar

提交回复
热议问题