解决高版本SpringBoot整合swagger时启动报错:Failed to start bean ‘documentationPluginsBootstrapper‘ 问题
一、控制台的报错信息
2021-12-29 15:15:04 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
二、解决办法有两种任选其一
1.方法一:配置 WebMvcConfigurer.java
package com.clesun.brandarchive.config;import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;/*** 解决高版本springboot整合swagger启动报错Failed to start bean 'documentationPluginsBootstrapper' 问题* @author Administrator*/
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurationSupport {/*** 发现如果继承了WebMvcConfigurationSupport,则在yml中配置的相关内容会失效。 需要重新指定静态资源* @param registry*/@Overridepublic 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.方法二:yml文件里进行配置
spring:mvc:pathmatch:matching-strategy: ant_path_matcher
3.启动
然后在页面就可以看到swagger
解决高版本SpringBoot整合swagger时启动报错:Failed to start bean ‘documentationPluginsBootstrapper‘ 问题相关推荐
- Swagger启动报错Failed to start bean ‘documentationPluginsBootstrapper‘
在配置类中加上: mvc:pathmatch:matching-strategy: ant_path_matcher
- 高版本springboot整合swagger
高版本springboot整合swagger 这是我的springboot版本2.6: ![!\[Alt\](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9hdmF ...
- Springboot 集成 Activiti时启动报错!'org.activiti.spring.boot.SecurityAutoConfiguration
Springboot 集成 Activiti时启动报错! org.springframework.beans.factory.BeanCreationException: Error creating ...
- xcode高版本常见的RN本地启动报错
xcode编译报错:'config.h' file not found 解决方案 cd node_modules/react-native/third-party/glog-0.3.4 ../../s ...
- SpringBoot整合es7.x启动报错:Rejecting mapping update to [AAA] as the final mapping would have more than 1
因为es6.x以后调整一个index只能有一个type,官方默认在所有的index自动加了一个_doc的type,所以当我们不指定或者指定不为_doc的type时,会报这个错误,解决方案: @Docu ...
- 整合rocketmq/stream-rocketmq启动报错channel.AbstractMessageChannel问题
springboot整合rocketmq/stream-rocketmq启动报错 spring boot.springcloud.springcloud alibaba项目整合rocketmq时.一启 ...
- 【已解决】Springboot服务 Netty启动报错Failed to submit a listener
[已解决]Springboot服务 Netty启动报错Failed to submit a listener Force-closing a channel whose registration ta ...
- SpringCloud - 整合Nacos启动报错Consider defining a bean of type IClientConfig
SpringCloud - 整合Nacos启动报错Consider defining a bean of type IClientConfig 前言 一. 尝试解决Bug的几种不合适方案 1.1 添加 ...
- idea 启动报错: Failed to create JVM.JVM.Path XXXXXXX\jbr\ 我的解决办法
idea 启动报错: Failed to create JVM.JVM.Path XXXXXXX\jbr\ 我的解决办法 在 C:\Users\Administrator\AppData\Roamin ...
最新文章
- 如何制作自己的CocoaPod库
- BZOJ3992:[SDOI2015]序列统计——题解
- CIO需“野蛮生长” 2017中国CIO高峰论坛7月开幕
- 论文笔记 A Spatial-Temporal Decomposition Based Deep Neural Network for TimeSeries Forecasting
- 一个项目中既有移动端,同时也有PC端的代码,并且 他们的代码分开写的,那么如何实现在手机跳转手机页面,pc点击跳转pc页面...
- 不降的数字(51Nod-2499)
- 提高linux运行速度,提高Linux操作系统的运行速度
- scrcpy设置快捷键_scrcpy——Android投屏神器(使用教程)
- 第一:Python+Allure运行报错AttributeError: module ‘allure‘ has no attribute ‘severity_level‘
- 有shi以来最详细的正则表达式入门教程
- 嵌入式单片机及外设(硬件)知识基础一
- 清北学堂noip2018集训D4
- 基于FPGA的LED全彩图形显示控制器设计
- python:如何删除一数组中包含7和7的倍数的数
- 阿卡迪亚大学计算机科学专业,阿卡迪亚大学世界排名解读
- Android 存储相册,Android 相册图片存储
- 用什么语言写游戏代码最好?
- Pytorch实现GAT(基于Message Passing消息传递机制实现)
- 全国大学生计算机等级考试计算机二级python真题复习链接
- webpack打开网页显示cannot get /
热门文章
- NOIP2020 赛前总结
- 2021牛客暑期多校训练营6
- P2469 [SDOI2010]星际竞速
- 【每日一题】5月7日题目精讲 「火」皇家烈焰
- NEC Programming Contest 2021 (AtCoder Beginner Contest 229)
- 数据结构之fhq-treap——Chef and Sets,[HNOI2012]永无乡,Play with Chain,[NOI2005]维修数列(结构体版代码)
- 带旋treap概念及模板,带例题:普通平衡树
- 洛谷P4762: [CERC2014]Virus synthesis(PAM)
- P3426-[POI2005]SZA-Template【KMP】
- 【图论】最短路上的统计(ssl 1500)