我在添加springdoc后尝试解决我的问题。 行家配置: SpringBoot 3.0.3 开放API 3 我尝试了其他版本的 sprindoc-ui,结果是一样的。如果有知道的答案请帮助我。
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.4</version>
</dependency>
当我尝试运行应用程序时:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'webFluxSupportConverter' defined in class path resource [org/springdoc/core/configuration/SpringDocConfiguration$SpringDocWebFluxSupportConfiguration.class]: Unsatisfied dependency expressed through method 'webFluxSupportConverter' parameter 0: Error creating bean with name 'objectMapperProvider' defined in class path resource [org/springdoc/core/configuration/SpringDocConfiguration.class]: Failed to instantiate [org.springdoc.core.providers.ObjectMapperProvider]: Factory method 'objectMapperProvider' threw exception with message: 'void org.springdoc.core.providers.ObjectMapperProvider.<init>(org.springdoc.core.properties.SpringDocConfigProperties)'
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springdoc.core.configuration.SpringDocConfiguration.objectMapperProvider(SpringDocConfiguration.java:442)
The following method did not exist:
'void org.springdoc.core.providers.ObjectMapperProvider.<init>(org.springdoc.core.properties.SpringDocConfigProperties)'
The calling method's class, org.springdoc.core.configuration.SpringDocConfiguration, was loaded from the following location:
jar:file:/C:/Users/user22/.m2/repository/org/springdoc/springdoc-openapi-starter-common/2.1.0/springdoc-openapi-starter-common-2.1.0.jar!/org/springdoc/core/configuration/SpringDocConfiguration.class
The called method's class, org.springdoc.core.providers.ObjectMapperProvider, is available from the following locations:
jar:file:/C:/Users/user22/.m2/repository/org/springdoc/springdoc-openapi-common/1.6.15/springdoc-openapi-common-1.6.15.jar!/org/springdoc/core/providers/ObjectMapperProvider.class
jar:file:/C:/Users/user22/.m2/repository/org/springdoc/springdoc-openapi-starter-common/2.1.0/springdoc-openapi-starter-common-2.1.0.jar!/org/springdoc/core/providers/ObjectMapperProvider.class
The called method's class hierarchy was loaded from the following locations:
org.springdoc.core.providers.ObjectMapperProvider: file:/C:/Users/user22/.m2/repository/org/springdoc/springdoc-openapi-common/1.6.15/springdoc-openapi-common-1.6.15.jar
io.swagger.v3.core.util.ObjectMapperFactory: file:/C:/Users/user22/.m2/repository/io/swagger/core/v3/swagger-core/2.2.8/swagger-core-2.2.8.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.springdoc.core.configuration.SpringDocConfiguration and org.springdoc.core.providers.ObjectMapperProvider