Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean 解决方案

SpringBoot启动时的异常信息

"C:\Program Files\Java\jdk1.8.0_161\bin\java" ......... com.fangxing.javalearning.annotationlearning.ComponentScanApp
hello world.   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::        (v2.0.0.RELEASE)2018-04-03 22:25:07.232  INFO 4976 --- [           main] c.f.j.a.ComponentScanApp                 : Starting ComponentScanApp on DESKTOP-BHGM3HS with PID 4976 (started by hasee in D:\test\projects\java-learning)
2018-04-03 22:25:07.237  INFO 4976 --- [           main] c.f.j.a.ComponentScanApp                 : No active profile set, falling back to default profiles: default
2018-04-03 22:25:07.321  INFO 4976 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@45f45fa1: startup date [Tue Apr 03 22:25:07 CST 2018]; root of context hierarchy
2018-04-03 22:25:07.664  WARN 4976 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.2018-04-03 22:25:08.238 ERROR 4976 --- [           main] o.s.boot.SpringApplication               : Application run failedorg.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at com.fangxing.javalearning.annotationlearning.ComponentScanApp.main(ComponentScanApp.java:15) [classes/:na]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:204) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:178) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]... 8 common frames omittedProcess finished with exit code 1
错误的产生是:未能加载嵌入的供web应用加载的空间,是因为缺少ServletWebServerFactory bean

解决方案: 添加@EnableAutoConfiguration注解
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/531028.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

bootstrap 栅栏布局中 col-xs-*、col-sm-*、col-md-*、col-lg-* 区别及使用方法

(1)概括 一句话概括:根据显示屏幕宽度的大小,自动的选用对应的类的样式。 (2)关键字段 1、col是column简写:列; 2、xs是maxsmall简写:超小, sm是small简写&…

Huffman编码的设计与实现

文章目录(一)设计描述(二)需求分析(三)详细设计(四)代码实现与测试(五)个人总结(一)设计描述 1.题目描述 设计一个利用哈夫曼算法的编…

C / C++ 经典代码和常考类型

文章目录C语言常考类型经典代码1) 兔子问题2) 斐波那契数列3) 百元买百鸡4) 实心菱形5) 空心菱形6) 十进制转换为二进制7) 水仙花8) 大数相加9) 冒泡排序10) …

如何在GitHub上下载开源文件

具体实现步骤 1 . 在本地安装Git,下载地址:点击下载 2 . 下载完成后开始安装,安装过程勾选下面内容: 1.Git Bash here2.Git GUI here 然后一直点击next,安装完成即可。 3 . 在打开的git窗口中输入 git init 4 . 在下载的项目的…

C/C++课程设计 ——货物管理系统

文章目录1&#xff09; 货物管理系统1.02&#xff09; 货物管理系统2.01&#xff09; 货物管理系统1.0 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<windows.h> typedef struct goo…

IDEA连接mysql报Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' 的错误

IDEA布置好项目后&#xff0c;连接Mysql&#xff0c;提示时区错误&#xff0c;解决方案如下&#xff1a; 在mysql的命令模式下&#xff0c;输入&#xff1a; set global time_zone8:00;如图所示&#xff1a;

JDBC 提示:WARN: Establishing SSL connection without server's identity verification is not recommended.

Java连接Mysql数据库的过程中出现了如下的警告信息: WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45, 5.6.26 and 5.7.6 requirements SSL connection must be established by default if explic…

C/C++课程设计 之学生管理系统(一)

文章目录1) 案例一2) 案例二3) 案例三4) 案例四5) 案例五6) 案例六7) 案例七8) 案例八9) 案例九10&#xff09;案例十11&#xff09;案例十一12&#xff09;案例十二13&#xff09;案例十三14&#xff09;案例十四15&#xff09;案例十五&#xff08;一&#xff09; 新生基本信…

C语言小游戏 ——推箱子

文章目录&#xff08;1&#xff09;内容描述&#xff08;2&#xff09;功能&#xff08;3&#xff09;设计目的&#xff08;4&#xff09;总体设计&#xff08;5&#xff09;明显缺点&#xff08;6&#xff09;个人总结7. 实例实例一实例二实例三实例四实例五&#xff1a;&…

Java GUI 实现登录界面

具体效果图&#xff1a; 详细代码&#xff1a; package java_gui;import java.awt.Color; import java.awt.Container; import java.awt.Cursor; import java.awt.Font; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;imp…

for-each循环的认识、定义、适用对象、举例、局限性

文章目录1. for-each的认识2. for-each的定义3. 哪些类型的对象可以适用For-Each&#xff1f;4. for-each的举例5. for-each的局限性1. for-each的认识 &#xff08;1&#xff09;for-each语句是Java中for-Index的一种加强&#xff0c;是Java 5带来的新语法糖。 &#xff08;2…

C语言 实现登录注册功能

文章目录加载动画实验结果图实验代码加载动画 #include<iostream> #include<windows.h> using namespace std;int main(){cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;cout.widen(65);co…

C语言小游戏 ——俄罗斯方块

#include<stdio.h> #include<stdlib.h> #include<windows.h>//Sleep()函数的头文件 #include<time.h> #include<conio.h> #define MOD 28 #define SIZE_N 19//控制边框的高度 #define SIZE_M 12 //控制边框的宽度 int a[100]{200,30,20};/…

C/C++课程设计 之职工管理系统

文章目录 (一) 题目内容及简介(二) 概要设计(三) 详细设计(四) 实现代码(五) 相关案例案例一案例二案例三案例四案例五案例六案例七案例八案例九案例十案例十一(一) 题目内容及简介 1.课题来源 课题名称和来源,主要介绍为何选择此题目来开展课程设计,此课题的开展能体现面向…

C++ 知识要点

1.类与对象 类是事物的抽象。类的对象就是类的具体化&#xff0c;实际化 2.C三大特性 继承、封装、多态 3.C父类与子类继承过程中&#xff0c;子类的特点&#xff1f; 子类拥有父类的所有属性和行为 子类就是一种特殊的父类 子类对象可以当作父类对象使用 子类中可以添加父类…

C/C++小游戏 ——贪吃蛇

文章目录案例一案例二案例三案例四案例五案例六案例七案例八案例九案例一 #include <stdio.h>#include <windows.h>#include <conio.h>#include <time.h>//游戏窗口#define FrameX 4//游戏窗口左上角的X轴坐标#define FrameY 4//游戏窗口左上角的Y轴坐…

C/C++课程设计 新生入学管理系统(二)

文章目录 案例十六案例十七案例十八案例十九案例二十案例二十一案例二十二案例二十三案例二十四案例二十五案例二十六案例二十七案例二十八案例十六 #include<iostream> #include<cstring> //strcpy,strcmp #

Java类名.方法和变量

文章目录(1) 类名.方法(2) 变量(1) 类名.方法 要是类名直接调用的方法&#xff0c;那这个方法就是静态的(static)方法&#xff0c;是不用new出新对象实例就可以直接调用的方法。看下面例子&#xff1a; class A {public static void Method1(int a, int b) {//方法体}public …

Java小案例(二) 用数组实现增删查改排序

文章目录案例一案例二案例三案例四案例五案例一 Student.Java package curd;public class Student {private String stuid;private String name;private int chinese;private int math;private int english;private int avg;private int sum;public int getAvg() {return avg;…

有趣的一行代码

文章目录爱心曼德勃罗集合打印99乘法表实现快速排序禅语漫画迷宫爱心 print(\n.join([.join([(❤❤❤❤❤❤❤❤❤❤❤❤[(x-y)%12]if((x*0.05)**2(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3<0 else )for x in range(-30,30)])for y in range(15,-15,-1)]))效果图&#xff1…