org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException报错问题
这个原因是
高版本SpringBoot整合swagger 造成的

我的项目是2.7.8

swagger版本是3.0.0
就会出现上面的报错
解决方式:
1.配置WebMvcConfigurer.java
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurationSupport {
/**
* 发现如果继承了WebMvcConfigurationSupport,则在yml中配置的相关内容会失效。 需要重新指定静态资源
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**").addResourceLocations(
"classpath:/static/");
registry.addResourceHandler("swagger-ui.html", "doc.html").addResourceLocations(
"classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations(
"classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
}
2.在配置文件application.yml中添加
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException报错问题的更多相关文章
- SpringBoot项目启动org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException解决方法
将Pom文件中的SpringBoot版本调低即可. 我的是调成了2.5.6
- Failed to start bean 'stompBrokerRelayMessageHandler'; nested exception is java.lang.NoClassDefFoundError: reactor/io/codec/Codec
最新版本的Spring需要reactor 2.0,看看你的POM有一个明确的1.1.6依赖. 解决: <dependency> <groupId>org.projectreac ...
- org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplic
org.springframework.context.ApplicationContextException: Unable to start web server; nested exceptio ...
- ?--Porg.springframework.beans.MethodInvocationException: Property 'username' threw exception; nested exception is java.lang.NullPointerException
使用BoneCP作为连接池,在启动Tomcat报出以下异常: 一月 02, 2016 2:12:17 下午 org.apache.tomcat.util.digester.SetPropertiesR ...
- SpringBoot项目意外出现 循环依赖和注入的对象意外是Null的问题 Requested bean is currently in creation: Is there an unresolvable circular reference? 或 nested exception is java.lang.NullPointerException
1.Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ...
- HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException
HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException type ...
- error:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
问题:调用的方法在一个接口类中,但我并没有注入那个被调用的类 解决:在UserEntity前加上@Autowired @Controller public class MainController { ...
- 报错:严重: Servlet.service() for servlet [springmvc] in context with path [ ] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
解决:service类或dao类需要@Autowired
- 14- Servlet.service() for servlet [mvc-dispatcher] in context with path [/collegeservice] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root caus
有的service没有依赖注入:
- SpringBoot项目集成Swagger启动报错: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is
使用的Swagger版本是2.9.2.knife4j版本是2.0.4. SpringBoot 版本是2.6.2将SpringBoot版本回退到2.5.6就可以正常启动
随机推荐
- [Bread.Mvc] 开源一款自用 MVC 框架,支持 Native AOT
Bread.Mvc Bread.Mvc 是一款完全支持 Native AOT 的 MVC 框架,搭配同样支持 AOT 的 Avalonia,让你的开发事半功倍.项目开源在 Gitee,欢迎 Star. ...
- brpc internal
brpc 内部实现 thread model pthread 1:1atomic cache同步降低性能 fiber n:1 -> nginx 多核难以扩展, 用户不能做阻塞操作. contex ...
- Web3.0时代的全新合作模式:DAO
你有没有遇到这种情况:我有一个很棒的想法,想要开发出一个"改变世界"的项目,但是我既没有技术,也没有人脉,甚至没有资金,导致我始终没有办法开始行动,痛苦万分.就比如在黑客大赛上,我 ...
- 位图(bitmap)原理以及实现
大家好,我是蓝胖子,我一直相信编程是一门实践性的技术,其中算法也不例外,初学者可能往往对它可望而不可及,觉得很难,学了又忘,忘其实是由于没有真正搞懂算法的应用场景,所以我准备出一个系列,囊括我们在日常 ...
- Mysql高级11-后台进程
一.前言 MySQL的服务实现通过后台多个线程.内存池.文件交互来实现对外服务的,不同线程实现不同的资源操作,各个线程相互协助,共同来完成数据库的服务.MySQL常用的后台线程概括如下,分为Maste ...
- Nhk R1 Editorial
前言 这场比赛的锅貌似有点多-在准备的时候就已经推迟过三次,在这里为对各位比赛时造成的困扰抱歉.这是出题组第一次放比赛,欢迎批评指正. 主要问题在于 C 的数据造水了,hack 数据造反了于是没有 h ...
- Solution -「洛谷 P6287」「COCI 2016-2017」Mag
Description Link. 定义一条链的价值为链上点权乘积除以节链上点数,求一条价值最小的链. Solution 结论:答案链上最多包含一个 \(2\)(其余全为 \(1\)),并且不在链的两 ...
- ClickHouse(15)ClickHouse合并树MergeTree家族表引擎之GraphiteMergeTree详细解析
GraphiteMergeTree该引擎用来对Graphite数据(图数据)进行瘦身及汇总.对于想使用ClickHouse来存储Graphite数据的开发者来说可能有用. 如果不需要对Graphite ...
- Excel--比较两列数据的异同
首先得到的数据分为两列,两种类型.由于在网站上搜索的时候,网站的"特殊性"会将000638-32-4 前面的0全部去掉.变成了638-32-4.基于得到了两列稍有不同的数据.由于人 ...
- 轻松掌握组件启动之MongoDB:快速入门、Linux安装和Docker配置指南
引言 我们将继续深入研究组件启动专题.在之前的文章中,我们已经详细介绍了Redis的各种配置使用方法,为读者提供了全面的指导.然而,今天我们将转向另一个备受关注的数据库--MongoDB.MongoD ...