當(dāng)前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
解决高版本SpringBoot整合swagger时启动报错:Failed to start bean ‘documentationPluginsBootstrapper‘ 问题
生活随笔
收集整理的這篇文章主要介紹了
解决高版本SpringBoot整合swagger时启动报错:Failed to start bean ‘documentationPluginsBootstrapper‘ 问题
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一、控制臺(tái)的報(bào)錯(cuò)信息
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啟動(dòng)報(bào)錯(cuò)Failed to start bean 'documentationPluginsBootstrapper' 問題* @author Administrator*/ @Configuration public class WebMvcConfigurer extends WebMvcConfigurationSupport {/*** 發(fā)現(xiàn)如果繼承了WebMvcConfigurationSupport,則在yml中配置的相關(guān)內(nèi)容會(huì)失效。 需要重新指定靜態(tài)資源* @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文件里進(jìn)行配置
spring:mvc:pathmatch:matching-strategy: ant_path_matcher3.啟動(dòng)
然后在頁面就可以看到swagger
總結(jié)
以上是生活随笔為你收集整理的解决高版本SpringBoot整合swagger时启动报错:Failed to start bean ‘documentationPluginsBootstrapper‘ 问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 新老电脑必装的三款良心软件老电脑必备软件
- 下一篇: java中configmanager_S