spring-boot - Springfox Boot Starter 3.0.0 JsonSerializer 错误
问题描述
我在我的项目中使用io.springfox 3.0.0 版本。我将依赖项添加到我的 build.gradle 文件中,如下所示:
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
外部库按预期创建:
io.springfox:springfox-boot-starter:3.0.0
io.springfox:springfox-core:3.0.0
io.springfox:springfox-data-rest:3.0.0
io.springfox:springfox-oas:3.0.0
io.springfox:springfox-schema:3.0.0
io.springfox:springfox-spi:3.0.0
io.springfox:springfox-spring-web:3.0.0
io.springfox:springfox-spring-web-flux:3.0.0
io.springfox:springfox-spring-web-mvc:3.0.0
io.swagger.core.v3:swagger-annotation:2.1.2
io.swagger.core.v3:swagger-models:2.1.2
我正在使用 Spring Boot 2.4.2 和 Java 11。
当我运行我的 Spring Boot 应用程序时,我收到以下错误:
org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为“swagger2ControllerWebMvc”的 bean 在 URL [jar:file:/opt/rally/dynamicscreen-service/lib/springfox-swagger2.jar!/springfox/documentation/swagger2/ 中定义时出错web/Swagger2ControllerWebMvc.class]:通过构造函数参数2表示的不满足的依赖关系;嵌套异常是 org.springframework.beans.factory.BeanCreationException:在 springfox.documentation.spring.web.SpringfoxWebConfiguration 中创建名称为“jsonSerializer”的 bean 时出错:通过工厂方法实例化 bean 失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:无法实例化 [springfox.documentation.spring.web.json.JsonSerializer]:工厂方法 'jsonSerializer' 抛出异常;嵌套异常是 java.lang。
我哪里做错了?
解决方案
推荐阅读
- python - 将 TensorFlow 升级到 2.0 的问题
- javascript - 在 JavaScript 中自动播放暂停的视频元素
- python - 如何使用 Selenium 和 Python 在信用卡号字段中输入日期?
- java - Javafx如何制作一个按钮来显示和隐藏标签
- c# - 如何在 Microsoft.Identity.Web 中定义 SignedOut 页面?
- swift - 为什么我可以将自定义对象作为字段上传到 Firestore 文档?
- javascript - 无法将数组值输入图形
- ansible - 如果任务失败,Ansible 保管库密码会显示在日志中
- python - Pandas:如何在系列单元格中搜索部分字符串匹配?
- javascript - 如何在线使用 Python OpenCV VideoCapture?