Java异常处理003:Springboot启动报Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean异常
异常日志
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.
分析原因
- 原因不详
异常解决
- 在启动类加上@EnableAutoConfiguration注解
package com.hs.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @SpringBootConfiguration @EnableAutoConfiguration public class DeptProvider8001_App { public static void main(String[] args){ SpringApplication.run(DeptProvider8001_App.class,args); } }
启动成功
. ____ _ __ _ _ /\\ / ___‘_ __ _ _(_)_ __ __ _ \ \ \ ( ( )\___ | ‘_ | ‘_| | ‘_ \/ _` | \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ‘ |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.9.RELEASE)