欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

knife4j+springboot3.4異常無(wú)法正確展示文檔

 更新時(shí)間:2025年01月13日 10:01:40   作者:立小言先森  
本文主要介紹了knife4j+springboot3.4異常無(wú)法正確展示文檔,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

場(chǎng)景復(fù)現(xiàn):

  • knife4j-openapi3-jakarta-spring-boot-starter版本
<!-- https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-openapi3-jakarta-spring-boot-starter -->
<dependency>
    <groupId>com.github.xiaoymin</groupId>
    <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
    <version>4.5.0</version>
</dependency>
  • 原來(lái)使用springboot3.3.5版本,先升級(jí)到3.4.0版本

  • 通過(guò)http://ip:port/doc.html訪問(wèn)接口文檔發(fā)現(xiàn)訪問(wèn)/v3/api-docs接口時(shí)報(bào)

Handler dispatch failed: java.lang.NoSuchMethodError: 'void org.springframework.web.method.ControllerAdviceBean.<init>(java.lang.Object)

通過(guò)分析異常日志發(fā)現(xiàn)是ControllerAdviceBean類報(bào)錯(cuò),在springboot3.3.5時(shí)spring-web版本是6.1.14,springboot3.4版本是6.2.0版本。

通過(guò)springboot全局異常捕獲堆棧信息發(fā)現(xiàn):

org.springdoc.core.service.GenericResponseService.lambda$getGenericMapResponse$8(GenericResponseService.java:702)

GenericResponseService類是在如下包:

<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-common -->
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-common</artifactId>
    <version>2.3.0</version>
</dependency>

GenericResponseService類的702行代碼如下(ControllerAdviceBean類使用一個(gè)參數(shù)的構(gòu)造函數(shù),但是報(bào)異常):

List<ControllerAdviceInfo> controllerAdviceInfosNotInThisBean = controllerAdviceInfos.stream()
					.filter(controllerAdviceInfo ->
							new ControllerAdviceBean(controllerAdviceInfo.getControllerAdvice()).isApplicableToBeanType(beanType))
					.filter(controllerAdviceInfo -> !beanType.equals(controllerAdviceInfo.getControllerAdvice().getClass()))
					.toList();

spring-web6.1.14版本中ControllerAdviceBean的構(gòu)造函數(shù):

	public ControllerAdviceBean(Object bean) {
		Assert.notNull(bean, "Bean must not be null");
		this.beanOrName = bean;
		this.isSingleton = true;
		this.resolvedBean = bean;
		this.beanType = ClassUtils.getUserClass(bean.getClass());
		this.beanTypePredicate = createBeanTypePredicate(this.beanType);
		this.beanFactory = null;
	}

spring-web6.2.0版本中ControllerAdviceBean的構(gòu)造函數(shù):

	public ControllerAdviceBean(String beanName, BeanFactory beanFactory, ControllerAdvice controllerAdvice) {
		Assert.hasText(beanName, "Bean name must contain text");
		Assert.notNull(beanFactory, "BeanFactory must not be null");
		Assert.isTrue(beanFactory.containsBean(beanName), () -> "BeanFactory [" + beanFactory +
				"] does not contain specified controller advice bean '" + beanName + "'");
		Assert.notNull(controllerAdvice, "ControllerAdvice must not be null");

		this.beanName = beanName;
		this.isSingleton = beanFactory.isSingleton(beanName);
		this.beanType = getBeanType(beanName, beanFactory);
		this.beanTypePredicate = createBeanTypePredicate(controllerAdvice);
		this.beanFactory = beanFactory;
	}

此類中的構(gòu)造函數(shù)已經(jīng)變更為4個(gè),已經(jīng)不存在一個(gè)參數(shù)的構(gòu)造函數(shù)了。

  • springdoc-openapi-starter-common文檔當(dāng)前已經(jīng)升級(jí)到2.7.0版本
<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-common -->
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-common</artifactId>
    <version>2.7.0</version>
</dependency>

結(jié)論:期待knife4j-openapi3-jakarta-spring-boot-starter早日升級(jí),兼容最新版本的spring;

開(kāi)源SDK:https://github.com/mingyang66/spring-parent

到此這篇關(guān)于knife4j+springboot3.4異常無(wú)法正確展示文檔的文章就介紹到這了,更多相關(guān)knife4j springboot3.4異常無(wú)法展示內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • WebFlux 服務(wù)編排使用優(yōu)勢(shì)詳解

    WebFlux 服務(wù)編排使用優(yōu)勢(shì)詳解

    這篇文章主要為大家介紹了WebFlux 服務(wù)編排使用優(yōu)勢(shì)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-05-05
  • 用Rational Rose逆向工程(java)生成類圖(教程和錯(cuò)誤解決)

    用Rational Rose逆向工程(java)生成類圖(教程和錯(cuò)誤解決)

    Rational Rose有個(gè)很方便的功能,將項(xiàng)目中的JAVA代碼自動(dòng)轉(zhuǎn)換成UML類圖
    2013-02-02
  • Java多線程之FutureTask的介紹及使用

    Java多線程之FutureTask的介紹及使用

    之前介紹了線程池相關(guān)的對(duì)象,Runable Callable與Future,下面介紹FutureTask的作用,它的特性是怎樣的呢,需要的朋友可以參考下
    2021-06-06
  • Java中處理各類配置文件的7種工具使用詳解

    Java中處理各類配置文件的7種工具使用詳解

    在Java應(yīng)用開(kāi)發(fā)中,選擇合適的配置文件格式和處理工具對(duì)于提高開(kāi)發(fā)效率和系統(tǒng)靈活性至關(guān)重要,本文為大家整理了7個(gè)有效的工具,需要的可以了解下
    2025-05-05
  • java多線程之wait(),notify(),notifyAll()的詳解分析

    java多線程之wait(),notify(),notifyAll()的詳解分析

    本篇文章是對(duì)java多線程 wait(),notify(),notifyAll()進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
    2013-06-06
  • Java軟件設(shè)計(jì)模式之適配器模式詳解

    Java軟件設(shè)計(jì)模式之適配器模式詳解

    這篇文章主要介紹了Java軟件設(shè)計(jì)模式之適配器模式詳解,適配器模式可分為對(duì)象適配器和類適配器兩種,在對(duì)象適配器模式中,適配器與適配者之間是關(guān)聯(lián)關(guān)系;在類適配器模式中,適配器與適配者之間是繼承(或?qū)崿F(xiàn))關(guān)系,需要的朋友可以參考下
    2023-07-07
  • Spring中最常用的注解之一@Autowired詳解

    Spring中最常用的注解之一@Autowired詳解

    本文講解了Spring中最常用的注解之一@Autowired, 平時(shí)我們可能都是使用屬性注入的,但是后續(xù)建議大家慢慢改變習(xí)慣,使用構(gòu)造器注入。同時(shí)也講解了這個(gè)注解背后的實(shí)現(xiàn)原理,需要的朋友可以參考下
    2023-01-01
  • @RequestBody的使用詳解

    @RequestBody的使用詳解

    這篇文章主要介紹了@RequestBody的使用詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-12-12
  • java實(shí)現(xiàn)Redisson看門狗機(jī)制

    java實(shí)現(xiàn)Redisson看門狗機(jī)制

    redission看門狗機(jī)制是解決分布式鎖的續(xù)約問(wèn)題,本文就來(lái)詳細(xì)的介紹一下java實(shí)現(xiàn)Redisson看門狗機(jī)制,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-09-09
  • SpringCloud+RocketMQ實(shí)現(xiàn)分布式事務(wù)的實(shí)踐

    SpringCloud+RocketMQ實(shí)現(xiàn)分布式事務(wù)的實(shí)踐

    分布式事務(wù)已經(jīng)成為了我們的經(jīng)常使用的。所以我們來(lái)一步一步的實(shí)現(xiàn)基于RocketMQ的分布式事務(wù)。感興趣的可以了解一下
    2021-10-10

最新評(píng)論