Scene reappearance:
- knife4j-openapi3-jakarta-spring-boot-starter version
<!-- /artifact//knife4j-openapi3-jakarta-spring-boot-starter --> <dependency> <groupId></groupId> <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId> <version>4.5.0</version> </dependency>
It turns out that using springboot 3.3.5 version, upgrade to 3.4.0 version first
Access to the interface document via http://ip:port/Docs interface time discovery access to /v3/api-docs interface time
Handler dispatch failed: : 'void .<init>()
By analyzing the exception log, it was found that the ControllerAdviceBean class reported an error. In springboot3.3.5, the spring-web version was 6.1.14, and springboot3.4 version was 6.2.0.
The stack information is discovered through springboot global exception capture:
$getGenericMapResponse$8(:702)
The GenericResponseService class is in the following package:
<!-- /artifact//springdoc-openapi-starter-common --> <dependency> <groupId></groupId> <artifactId>springdoc-openapi-starter-common</artifactId> <version>2.3.0</version> </dependency>
The 702 lines of code of GenericResponseService class are as follows (ControllerAdviceBean class uses a parameter constructor, but reports an exception):
List<ControllerAdviceInfo> controllerAdviceInfosNotInThisBean = () .filter(controllerAdviceInfo -> new ControllerAdviceBean(()).isApplicableToBeanType(beanType)) .filter(controllerAdviceInfo -> !(().getClass())) .toList();
The constructor of ControllerAdviceBean in spring-web6.1.14:
public ControllerAdviceBean(Object bean) { (bean, "Bean must not be null"); = bean; = true; = bean; = (()); = createBeanTypePredicate(); = null; }
The constructor of ControllerAdviceBean in spring-web6.2.0:
public ControllerAdviceBean(String beanName, BeanFactory beanFactory, ControllerAdvice controllerAdvice) { (beanName, "Bean name must contain text"); (beanFactory, "BeanFactory must not be null"); ((beanName), () -> "BeanFactory [" + beanFactory + "] does not contain specified controller advice bean '" + beanName + "'"); (controllerAdvice, "ControllerAdvice must not be null"); = beanName; = (beanName); = getBeanType(beanName, beanFactory); = createBeanTypePredicate(controllerAdvice); = beanFactory; }
The constructors in this class have been changed to 4, and there is no constructor with one parameter anymore.
- springdoc-openapi-starter-common documentation has been upgraded to version 2.7.0
<!-- /artifact//springdoc-openapi-starter-common --> <dependency> <groupId></groupId> <artifactId>springdoc-openapi-starter-common</artifactId> <version>2.7.0</version> </dependency>
Conclusion: Looking forward to the early upgrade of Knife4j-openapi3-jakarta-spring-boot-starter, which is compatible with the latest version of spring;
Open Source SDK:/mingyang66/spring-parent
This is the article about the inability to display the document correctly in the Knife4j+springboot3.4 exception. This is the end of this article. For more related contents of the Knife4j springboot3.4 exception, please search for my previous article or continue browsing the related articles below. I hope everyone will support me in the future!