最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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)文章

  • 如何讓W(xué)in10實(shí)現(xiàn)Java文件的開(kāi)機(jī)自啟動(dòng)

    如何讓W(xué)in10實(shí)現(xiàn)Java文件的開(kāi)機(jī)自啟動(dòng)

    這篇文章主要介紹了如何讓W(xué)in10實(shí)現(xiàn)Java文件的開(kāi)機(jī)自啟動(dòng),對(duì)于一些想要一直運(yùn)行的Java文件,就會(huì)造成每次系統(tǒng)更新之后的重啟導(dǎo)致Java文件無(wú)法繼續(xù)運(yùn)行。,需要的朋友可以參考下
    2019-06-06
  • JCommander解析命令行參數(shù)使用詳解

    JCommander解析命令行參數(shù)使用詳解

    這篇文章主要為大家介紹了JCommander解析命令行參數(shù)使用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-09-09
  • spring boot配置ssl實(shí)現(xiàn)HTTPS的方法

    spring boot配置ssl實(shí)現(xiàn)HTTPS的方法

    這篇文章主要介紹了spring boot配置ssl實(shí)現(xiàn)HTTPS的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2019-03-03
  • Feign調(diào)用全局異常處理解決方案

    Feign調(diào)用全局異常處理解決方案

    這篇文章主要介紹了Feign調(diào)用全局異常處理解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-06-06
  • 搭建JavaWeb服務(wù)器步驟詳解

    搭建JavaWeb服務(wù)器步驟詳解

    本篇文章主要給大家詳細(xì)分享了搭建JavaWeb服務(wù)器的詳細(xì)步驟以及用到的代碼,對(duì)此有需要的朋友可以跟著學(xué)習(xí)下。
    2018-02-02
  • Springboot3整合Mybatis-plus3.5.3報(bào)錯(cuò)問(wèn)題解決

    Springboot3整合Mybatis-plus3.5.3報(bào)錯(cuò)問(wèn)題解決

    在日常學(xué)習(xí)springboot3相關(guān)的代碼時(shí),在使用 SpringBoot3 整合 MyBatisplus 時(shí)出現(xiàn)了一些問(wèn)題,花了不少時(shí)間處理,這篇文章主要介紹了Springboot3整合Mybatis-plus3.5.3報(bào)錯(cuò)問(wèn)題解決,需要的朋友可以參考下
    2023-11-11
  • java web學(xué)習(xí)_淺談request對(duì)象中g(shù)et和post的差異

    java web學(xué)習(xí)_淺談request對(duì)象中g(shù)et和post的差異

    下面小編就為大家?guī)?lái)一篇java web學(xué)習(xí)_淺談request對(duì)象中g(shù)et和post的差異。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-05-05
  • idea中service或者mapper引入報(bào)紅的問(wèn)題及解決

    idea中service或者mapper引入報(bào)紅的問(wèn)題及解決

    在使用IntelliJ IDEA開(kāi)發(fā)SpringBoot項(xiàng)目時(shí),有時(shí)會(huì)遇到Service或Mapper接口引入時(shí)報(bào)紅但不影響項(xiàng)目運(yùn)行的情況,這主要是因?yàn)镮DEA的檢查級(jí)別設(shè)置問(wèn)題,解決方法是將有問(wèn)題的Error級(jí)別改為編譯通過(guò)的安全級(jí)別,即可消除報(bào)紅
    2024-09-09
  • java實(shí)現(xiàn)RedisTemplate操作哈希數(shù)據(jù)

    java實(shí)現(xiàn)RedisTemplate操作哈希數(shù)據(jù)

    RedisTemplate是Spring Data Redis提供的一個(gè)用于操作Redis的模板類,本文主要介紹了java實(shí)現(xiàn)RedisTemplate操作哈希數(shù)據(jù),具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-09-09
  • java調(diào)用process線程阻塞問(wèn)題的解決

    java調(diào)用process線程阻塞問(wèn)題的解決

    這篇文章主要介紹了java調(diào)用process線程阻塞問(wèn)題的解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-06-06

最新評(píng)論

永嘉县| 比如县| 武义县| 肃南| 大丰市| 南陵县| 沁水县| 沁水县| 上犹县| 邳州市| 修文县| 南充市| 岱山县| 林口县| 玛曲县| 陈巴尔虎旗| 和平县| 永济市| 建平县| 新余市| 安远县| 额尔古纳市| 淮安市| 峨边| 双辽市| 岳西县| 修武县| 余干县| 来宾市| 二连浩特市| 隆子县| 太白县| 班戈县| 阳高县| 武陟县| 额济纳旗| 咸阳市| 富宁县| 绵阳市| 岗巴县| 利津县|