无法在IntelliJ Idea中启动spring-boot应用程序
总览
我可以使用spring-boot的maven插件运行该应用程序,但不能在IDE中运行它。以下几行提供有关我的程序的一些详细信息。
应用程序类如下:
package com.blss.retailServices.dataExportRouter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.velocity.VelocityAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
@EnableAutoConfiguration(exclude = { VelocityAutoConfiguration.class })
public class DataExportRouterApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(DataExportRouterApplication.class, args);
}
}
异常堆栈跟踪如下:
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:133) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at com.blss.retailServices.dataExportRouter.DataExportRouterApplication.main(DataExportRouterApplication.java:14) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_74]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_74]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_74]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_74]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
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:185) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
... 13 common frames omitted
我使用@SpringbootApplication但无济于事。
题
因此,如果有人可以帮助我解决此问题,我将不胜感激。
-
我猜想您有一个
war
与Maven一起打包的项目,并且已标记了所提供的servlet引擎(tomcat)。不幸的是,IntellIJIDEA并未在运行时类路径中添加
provided
依赖项,这就是为什么从IDE运行项目时项目无法工作的原因。更新7/30/2019
根据Giorgio:
他们在“应用程序运行配置”中添加了一个复选框,以“包括具有“已提供”作用域的依赖项”
-
Spring-boot应用程序不会在Docker内部启动时启动
2021-02-02 关注 0 浏览117 1答案
-
Spring Boot Actuator应用程序无法在Ubuntu VPS上启动
2021-02-02 关注 0 浏览80 1答案
-
Spring Boot Actuator应用程序无法在Ubuntu VPS上启动
2021-01-31 关注 0 浏览62 1答案
-
使用PropertiesLauncher启动的Spring-boot(特定于配置文件)应用程序中的问题覆盖应用程序属性
2021-02-02 关注 0 浏览110 1答案
-
Gradle Maven-publish无法构建独立的Spring-boot应用程序
2021-02-02 关注 0 浏览76 1答案
-
将现有的spring应用程序迁移到spring-boot,手动配置spring-boot?
2021-02-02 关注 0 浏览178 1答案
-
在非Spring-Boot应用程序中使用@ConfigurationProperties
2021-02-02 关注 0 浏览107 1答案
-
无法解决由Intelij Idea视图运行的Spring Boot应用程序
2021-02-02 关注 0 浏览140 1答案
-
Spring Tool Suite查找spring-boot集成测试配置,并且不启动主应用程序
2021-02-02 关注 0 浏览132 1答案
-
Tomcat不读取Spring-Boot应用程序属性
2021-02-02 关注 0 浏览140 1答案