已解决‘Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPoint

简介: 已解决‘Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPoint


🌷🍁 博主猫头虎(🐅🐾)带您 Go to New World✨🍁

🦄 博客首页——🐅🐾猫头虎的博客🎐

🐳 《面试题大全专栏》 🦕 文章图文并茂🦖生动形象🐅简单易学!欢迎大家来踩踩~🌺

🌊 《IDEA开发秘籍专栏》 🐾 学会IDEA常用操作,工作效率翻倍~💐

🌊 《100天精通Golang(基础入门篇)》 🐅 学会Golang语言,畅玩云原生,走遍大小厂~💐

🪁🍁 希望本文能够给您带来一定的帮助🌸文章粗浅,敬请批评指正!🐅🐾🍁🐥


🚀 已解决‘Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPointerException’问题

📢 作者:猫头虎博主

🗓 日期:2023-09-06


📌 前言

当大家尝试将Spring Boot升级到2.7.x时,可能会遭遇一些与旧版本的依赖不兼容的问题。其中,一个常见的错误就是Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException。本文主要介绍如何解决这个问题。


📘 目录

  • 原因分析
  • 解决方法
  • 总结

错误代码

09:50:14.151 [restartedMain] ERROR o.s.b.SpringApplication - [reportFailure,835] - Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
  at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
  at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
  at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
  at java.lang.Iterable.forEach(Iterable.java:75)
  at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
  at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
  at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
  at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745)
  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:420)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
  at com.ruoyi.RuoYiApplication.main(RuoYiApplication.java:20)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.NullPointerException: null
  at springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper.getPatterns(WebMvcPatternsRequestConditionWrapper.java:56)
  at springfox.documentation.RequestHandler.sortedPaths(RequestHandler.java:113)
  at springfox.documentation.spi.service.contexts.Orderings.lambda$byPatternsCondition$3(Orderings.java:89)
  at java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469)
  at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)

1️⃣ 原因分析

从Spring Boot 2.5.x开始,Spring MVC的默认路径匹配策略已经变更为PathPattern。之前版本使用的是AntPathMatcher,这种变化可能与某些旧版本的依赖产生不兼容问题,例如旧版本的Springfox。


2️⃣ 解决方法

要解决上述问题,我们可以通过设置Spring MVC的路径匹配策略回到AntPathMatcher

步骤1: 更新配置

在你的application.ymlapplication.properties中添加以下配置:

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

步骤2: 依赖管理

确保你的pom.xml中添加了正确版本的Spring Boot和Spring Cloud Alibaba的依赖。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.x</version>
    ...
</parent>

(⚠️ 注意: 这里只是一个简化的依赖样例,请根据实际情况进行调整。)


3️⃣ 总结

虽然技术持续地更新和进步,但这也带来了版本升级中的不兼容问题。希望通过这篇文章,大家能够轻松解决上述问题。如果你有任何问题或者建议,欢迎在评论区留言!


如果你觉得本文有帮助,请不吝点赞和分享!👍

原创声明

======= ·

  • 原创作者: 猫头虎

作者wx: [ libin9iOak ]

学习 复习

本文为原创文章,版权归作者所有。未经许可,禁止转载、复制或引用。

作者保证信息真实可靠,但不对准确性和完整性承担责任

未经许可,禁止商业用途。

如有疑问或建议,请联系作者。

感谢您的支持与尊重。

点击下方名片,加入IT技术核心学习团队。一起探索科技的未来,共同成长。


目录
相关文章
|
2月前
Exception in thread “main“ java.lang.NoClassDefFoundError: freemarker/template/Configuration
Exception in thread “main“ java.lang.NoClassDefFoundError: freemarker/template/Configuration
21 0
|
28天前
|
XML Java 程序员
作为Java程序员还不知道Spring中Bean创建过程和作用?
作为Java程序员还不知道Spring中Bean创建过程和作用?
15 0
|
2月前
|
Java Maven Spring
SpringBoot运行出现 Lookup method resolution failed; nested exception is java.lang.IllegalStateException
SpringBoot运行出现 Lookup method resolution failed; nested exception is java.lang.IllegalStateException
50 0
|
2月前
|
Java Spring
上传文件出现 aximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.
上传文件出现 aximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.
12 0
|
2月前
Exception in thread “main“ java.lang.UnsupportedOperationException
Exception in thread “main“ java.lang.UnsupportedOperationException
17 1
Java Bean 为什么必须要有一个无参构造函数?
JAVA EE 中,JavaBean 是一个很重要的概念,而 JavaBean 还有以下的使用习惯。 首先我们知道,有两种方法为java对象中的元素赋值:
671 0
Java Bean 为什么必须要有一个无参构造函数?
|
5天前
|
数据采集 存储 Java
高德地图爬虫实践:Java多线程并发处理策略
高德地图爬虫实践:Java多线程并发处理策略
|
3天前
|
设计模式 安全 Java
【JAVA】Java 中什么叫单例设计模式?请用 Java 写出线程安全的单例模式
【JAVA】Java 中什么叫单例设计模式?请用 Java 写出线程安全的单例模式
|
1天前
|
消息中间件 监控 安全
【JAVAEE学习】探究Java中多线程的使用和重点及考点
【JAVAEE学习】探究Java中多线程的使用和重点及考点
|
1天前
|
安全 Java 开发者
构建高效微服务架构:后端开发的新范式Java中的多线程并发编程实践
【4月更文挑战第29天】在数字化转型的浪潮中,微服务架构已成为软件开发的一大趋势。它通过解耦复杂系统、提升可伸缩性和促进敏捷开发来满足现代企业不断变化的业务需求。本文将深入探讨微服务的核心概念、设计原则以及如何利用最新的后端技术栈构建和部署高效的微服务架构。我们将分析微服务带来的挑战,包括服务治理、数据一致性和网络延迟问题,并讨论相应的解决方案。通过实际案例分析和最佳实践的分享,旨在为后端开发者提供一套实施微服务的全面指导。 【4月更文挑战第29天】在现代软件开发中,多线程技术是提高程序性能和响应能力的重要手段。本文通过介绍Java语言的多线程机制,探讨了如何有效地实现线程同步和通信,以及如