具體報錯以下: Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.spring
pom文件配置以下:tomcat
<dependency>
eclipse
<groupId>org.springframework.boot</groupId>
ide
<artifactId>spring-boot-starter-tomcat</artifactId>
spring-boot
<scope>provided</scope>
spa
</dependency>
code
在eclipse下是能夠正常啓動的,但在IEDA下遇到問題,網上查找發現該問題爲IEDA問題,在配置scope爲provided時,IDEA不會將依賴加到運行路徑下,致使出錯,嘗試了幾種解決方案:ip
1、刪掉<scope>
provided</scope>
,則默認爲compile,各個階段都會將依賴加入到classpath,執行驗證能夠啓動成功,可是若是要將最終包放入容器運行,則會包衝突;io
2、點擊工程右側Maven Projects-> 工程-> Plugins-> spring-boot -> spring-boot:run ,啓動工程,可成功啓動class