Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

简介: 自己新建的Maven 项目,然后通过修改 pom.xml 转为 Spring Boot 项目,出现此问题。启动日志如下:org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.

自己新建的Maven 项目,然后通过修改 pom.xml 转为 Spring Boot 项目,出现此问题。

启动日志如下:

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:137) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at com.wanyu.fams.App.main(App.java:15) [classes/: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:189) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	... 8 common frames omitted

错误原因:

主类没有使用 @SpringBootApplication 注解。

解决方法:

添加注解,例如:

/**
 * Hello world!
 *
 */
@SpringBootApplication
@ServletComponentScan
@Configuration
@EnableAutoConfiguration
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        SpringApplication.run(App.class, args);
    }
}


目录
相关文章
|
SQL 缓存 NoSQL
接口的幂等性设计和防重保证,详细分析幂等性的几种实现方法
本篇文章详细说明了幂等性,解释了什么是幂等性,幂等性的使用场景,讨论了幂等和防重的概念。分析了幂等性的情况以及如何设计幂等性服务。阐述了幂等性实现防重的几种策略,包括乐关锁,防重表,分布式锁,token令牌以及支付缓冲区。
9717 0
接口的幂等性设计和防重保证,详细分析幂等性的几种实现方法
|
数据采集 数据挖掘 UED
物流产品体验诊断与优化
物流产品体验诊断与优化
1119 1
|
XML SQL Java
Spring 是如何保证一个事务内获取同一个Connection
Spring 是如何保证一个事务内获取同一个Connection
855 1
Spring 是如何保证一个事务内获取同一个Connection
|
11月前
|
人工智能 自然语言处理 搜索推荐
企业客户服务效率低、体验差,如何通过大模型技术改善?一文了解面向客户服务全场景的行业大模型的3大应用方向
本文三桥君探讨了大模型技术在客户服务领域的应用与实践。从架构设计出发,详细解析了面向客户、客服和运营三大场景的智能功能模块,包括业务咨询、情感关怀、智能点选、知识采编等12项核心功能。AI产品专家三桥君指出,通过行业大模型定制、多源数据整合等技术手段,企业可实现客户服务的智能化升级,显著提升客户体验和运营效率。
558 0
|
存储 人工智能 数据中心
Q3财报:阿里云收入增长13%至317.42亿元
Q3财报:阿里云收入增长13%至317.42亿元
1156 13
|
安全 机器人 API
AppFlow通义千问机器人支持上下文会话
在最新升级的AppFlow中,通义千问对话功能现已支持上下文保留,使对话体验更加流畅。用户可通过配置AppFlow连接流,结合钉钉机器人实现与通义千问的交互。只需几步简单设置,即可在群聊中@机器人进行连续对话。此外,提供了两种创建钉钉机器人的方法:使用Outgoing机制或钉钉开放平台,方便不同需求的用户进行集成。通过这些步骤,您可以轻松实现与通义千问的高效沟通。
920 0
如何用Java写一个规范的http接口?
在平常的工作中,经常会遇到要写接口的情况,现在最常用的就是http接口,今天我就介绍一下如何去写一个规范的http接口。
1146 0
|
存储 Java
Java中利用BitMap位图实现海量级数据去重
Java中利用BitMap位图实现海量级数据去重
BXA
|
JSON 前端开发 Java
Spring Boot与GraphQL实现API查询
Spring Boot是一个快速搭建应用程序的框架,它能够简化应用程序的开发和部署,是一个非常流行的Java框架。GraphQL是一种用于API查询的语言,能够非常方便地实现API查询和传输。当这两种技术结合起来时就可以得到一种非常强大的API查询解决方案。
BXA
8993 2
|
存储 JSON NoSQL
Redis 数据类型hash以及使用场景
Redis 数据类型hash以及使用场景
6672 3
Redis 数据类型hash以及使用场景