项目启动时莫名其妙报
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
这个异常。
经过查找原因是因为我们的项目工程正在进行springboot的改造,引入了springboot-starter之后,其自动引入了tomcat,我们项目本身启动又引用了外部环境的tomcat导致了冲突
解决:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 如果在使用自带tomcat请注释下面,如果使用第三方tomcat不要注释下面 -->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
把starter-web下引入的tomcat过滤掉即可
重启我们的服务,正常启动了