Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.

springboot启动错误如下:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled.
09:19:44 [main] ERROR o.s.boot.SpringApplication - Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)
at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:537)
at org.springframework.context.support.AbstractApplicationContext.jrLockAndRefresh(AbstractApplicationContext.java:40002)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:41008)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.jytc.BootdoApplication.main(BootdoApplication.java:20)
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:189)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
… 10 common frames omitted

解决方法:

网上查了半天没找到解决方法,后来发现我用的是springboot内嵌Tomcat启动的,但是pom.xml导入spring-boot-starter-web时将Tomcat移除了,如图:
Error starting ApplicationContext. To display the auto-configuration report re-run your application
然后把代码块移除或者注释掉就可以了,希望对大家有帮助。如下图:
Error starting ApplicationContext. To display the auto-configuration report re-run your application

相关文章:

  • 2021-10-08
  • 2021-11-20
  • 2021-12-06
  • 2022-12-23
猜你喜欢
  • 2021-09-22
  • 2021-04-24
  • 2022-12-23
  • 2021-11-09
  • 2021-03-31
  • 2021-10-19
相关资源
相似解决方案