Error creating bean with name 'dynamicResponseModelReader' defined in URL [jar:file:/C:/Users/%e6%88%98%e5%ad%90%e6%b6%b5/.m2/repository/com/github/xiaoymin/knife4j-spring/2.0.9/knife4j-spring-2.0.9.jar!/com/github/xiaoymin/knife4j/spring/plugin/DynamicResponseModelReader.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'springfox.documentation.schema.TypeNameExtractor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
时间: 2023-06-16 11:07:41 浏览: 1246
这个错误是由于Spring容器中没有找到名称为 `springfox.documentation.schema.TypeNameExtractor` 的bean,导致 `DynamicResponseModelReader` 类实例化失败。你需要检查一下你的代码,看看是否缺少了必要的依赖。或者你可以尝试升级 `knife4j-spring` 版本,看看是否能够解决该问题。
相关问题
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiDocumentationScanner' defined in URL [jar:file:/C:/Java/maven/maven-repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/ApiDocumentationScanner.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'apiListingScanner' defined in URL [jar:file:/C:/Java/maven/maven-repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/ApiListingScanner.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'apiDescriptionReader' defined in URL [jar:file:/C:/Java/maven/maven-repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/ApiDescriptionReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'cachingOperationReader' defined in URL [jar:file:/C:/Java/maven/maven-repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/CachingOperationReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'apiOperationReader' defined in URL [jar:file:/C:/Java/maven/maven-repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/readers/operation/ApiOperationReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'documentationPluginsManager': Unsatisfied dependency expressed through field 'documentationPlugins': Error creating bean with name 'documentationPluginRegistry': FactoryBean threw exception on object creation at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-6.0.10.jar:6.0.10]
这是一个 Spring 框架的异常信息,具体错误提示是 'UnsatisfiedDependencyException',意味着依赖注入失败。从异常信息中可以看到,出错的地方是在创建名为 'apiDocumentationScanner' 的 bean 时,该 bean 定义在 'ApiDocumentationScanner.class' 文件中。
进一步分析异常信息,发现 'apiDocumentationScanner' 的构造函数有一个参数依赖未满足,而这个参数在创建名为 'apiListingScanner' 的 bean 时也出现了依赖未满足的错误。继续往下追溯,发现 'apiListingScanner' 的构造函数又依赖于 'apiDescriptionReader' bean,而 'apiDescriptionReader' 的构造函数则依赖于 'cachingOperationReader' bean。最后,发现 'cachingOperationReader' 的构造函数又依赖于 'apiOperationReader' bean。
异常信息提示了最终出错的 bean 是 'documentationPluginsManager',它的一个字段 'documentationPlugins' 未能满足依赖。这个字段的类型是 'documentationPluginRegistry',在创建该 bean 时出现了异常。
根据异常信息所示的 jar 包路径可以看到,出错的类都属于 Springfox 框架的一部分。可能的原因是在配置 Springfox 相关的 bean 时出现了问题,可能是依赖版本不匹配或者配置有误。你可以检查一下相关的配置和依赖是否正确,并确保所有的依赖都被正确注入。
Error creating bean with name 'documentationPluginsBootstrapper' defined in URL [jar:file:/C:/Users/Administrator.SY-202303281047/.m2/repository/io/springfox/springfox-spring-web/2.10.5/springfox-spring-web-2.10.5.jar!/springfox/documentation/spring/web/plugins/DocumentationPluginsBootstrapper.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcRequestHandlerProvider' defined in URL [jar:file:/C:/Users/Administrator.SY-202303281047/.m2/repository/io/springfox/springfox-spring-webmvc/2.10.5/springfox-spring-webmvc-2.10.5.jar!/springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'instrumentPrestoreController' method
这是一个 Spring Boot 应用程序的错误,错误信息显示了一个依赖注入的问题。具体来说,Spring Boot 在初始化 `documentationPluginsBootstrapper` bean 时遇到了问题,因为它需要满足一个构造函数参数的依赖项,但是该依赖项无法满足。更具体地说,该依赖项是 `webMvcRequestHandlerProvider` bean,它本身也有一个构造函数参数的依赖项,即 `requestMappingHandlerMapping` bean。但是,在初始化 `requestMappingHandlerMapping` bean 时,它遇到了一个歧义映射的问题,因此无法正确初始化。解决这个问题需要进一步检查应用程序的配置和依赖项,以找到并解决这个歧义映射的问题。
阅读全文