当前位置: 首页 > news >正文

Error creating bean with name ‘apiModelSpecificationReader‘ defined in URL

问题:

        启动项目的时候,报错了

org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'apiModelSpecificationReader' defined in URL 
[jar:file:/D:/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-spring-web/3.0.0/a76f2fbe805bfd2798e20dc8f2cfbfad554d52da/springfox-spring-web-3.0.0.jar!/springfox/documentation/spring/web/scanners/ApiModelSpecificationReader.class]: 
Unsatisfied dependency expressed through constructor parameter 0; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 
'springfox.documentation.schema.ModelSpecificationProvider' available: expected at least 1 
bean which qualifies as autowire candidate. Dependency annotations: 
{@org.springframework.beans.factory.annotation.Qualifier(value=cachedModels)}

        检查了下swagger的版本,用的是:

    implementation("io.swagger:swagger-annotations:1.5.20")implementation("io.springfox:springfox-swagger2:2.9.2")implementation("io.springfox:springfox-swagger-ui:2.9.2")implementation("io.springfox:springfox-swagger-common:2.9.2")

        提示却是3.0.0

[jar:file:/D:/.gradle/caches/modules-2/files-2.1/
io.springfox/springfox-spring-web/3.0.0

复制了下路径,检查了下,确实是如此。

原来是新的项目swagger用的是3.0.0,用的是一样的路径,导致影响。 

处理1:

        把springfox-spring-web目录下的3.0.0目录删了,再启动,是正常的。

        但这样的话,有弄先的项目,又会出问题。

处理2:

        在build.grale文件里面添加:  exclude group: 'io.springfox', module: 'springfox-boot-starter'

configurations {developmentOnlyruntimeClasspath {extendsFrom developmentOnly}all {exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'exclude group: 'ch.qos.logback'exclude group: 'org.apache.solr'exclude group: 'io.springfox', module: 'springfox-boot-starter'}
}

这样启动就不受影响了。

总结:

        启动报Error creating bean with name 'apiModelSpecificationReader' defined in URL 是版本不一致的问题,加个去除对应模块去处理:exclude group: 'io.springfox', module: 'springfox-boot-starter'

http://www.lryc.cn/news/227147.html

相关文章:

  • CS224W6.2——深度学习基础
  • Linux c/c++服务器开发实践
  • 2023年11月在线IDE流行度最新排名
  • 视频批量剪辑:视频嵌套合并实战指南,剪辑高手速成秘籍
  • 每天一点python——day66
  • 搭建产品帮助中心其实很简单,方法都在这了!
  • (离散数学)命题及命题的真值
  • 计算机组成原理之处理器(流水线)
  • 国际阿里云:云服务器灾备方案!!!
  • 计算机msvcp140.dll重新安装的四个解决方法,专门解决dll文件丢失问题的方法
  • 提莫的idea的bug是真滴多
  • STM32笔记—EXTI外部中断
  • 小程序分享当前页面
  • 10. GPIO中断
  • 【离散数学必刷题】谓词逻辑(第二章 左孝凌版)刷完包过!
  • SpringBoot系列-2 自动装配
  • vue3+ts 前端实现打印功能
  • egg.js sequelize数据库操作配置
  • vagrant安装k8s集群
  • ArcGIS进阶:水源涵养功能分级评价操作
  • 数据结构与算法 | 第四章:字符串
  • 2023-11-rust-struct
  • Docker容器编排
  • 计算机中丢失mfc140u.dll怎么解决
  • postman设置动态token, 每次登录更新token
  • 架构师范文(AI写作)两篇
  • 基于SSM的电子病历系统
  • 一次sougo workflow库的使用过程
  • macOS Big Sur(macos11版本)
  • 泛微E-Office信息泄露漏洞复现