> 技术文档 > java.lang.NoSuchMethodError: ‘void org.springframework.web.method.ControllerAdviceBean.<init>解决办法_java.lang.nosuchmethoderror: \'void org.springframe

java.lang.NoSuchMethodError: ‘void org.springframework.web.method.ControllerAdviceBean.<init>解决办法_java.lang.nosuchmethoderror: \'void org.springframe


使用springboot3.5+knife4j4.4配置一切正常,启动时访问/doc.html报错java.lang.NoSuchMethodError: \'void org.springframework.web.method.ControllerAdviceBean.(java.lang.Object)

分析错误后发现: org.springdoc.core.service.GenericResponseService.lambda$getGenericMapResponse$8(GenericResponseService.java:702)

此处代码: new ControllerAdviceBean(controllerAdviceInfo.getControllerAdvice()).isApplicableToBeanType(beanType)) 用到了ControllerAdviceBean类的一个参数的构造函数,但是springboot3.4已经移除,只有一个三个构造函数的参数: public ControllerAdviceBean(String beanName, BeanFactory beanFactory, ControllerAdvice controllerAdvice) {

解决办法

将springboot降版本

    org.springframework.boot    spring-boot-starter-parent    3.3.12        com.github.xiaoymin    knife4j-openapi3-jakarta-spring-boot-starter    4.4.0