IDEA启动spring boot工程Unable to start EmbeddedWeb...

具体报错以下: 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

相关文章
相关标签/搜索