IDEA添加Swagger2:Parameter 0 of method linkDiscoverers in org. springframework hateoas.config.Hateoasconfiguration required a single bean, but 15 were found:

本文涉及的产品
应用实时监控服务ARMS - 应用监控,每月50GB免费额度
容器服务 Serverless 版 ACK Serverless,952元额度 多规格
容器镜像服务 ACR,镜像仓库100个 不限时长
简介: IDEA添加Swagger2:Parameter 0 of method linkDiscoverers in org. springframework hateoas.config.Hateoasconfiguration required a single bean, but 15 were found

1.异常复现

#一开始我写的依赖是这个然后报错 

<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.2.2</version>
        </dependency>
<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.2.2</version>
        </dependency>

image.png 2.问题解决

#替换依赖

<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

然后访问地址改为:http://localhost:8080/swagger-ui/index.html

相关文章
|
1月前
|
Java Spring
springboot 集成 swagger 2.x 和 3.0 以及 Failed to start bean ‘documentationPluginsBootstrapper‘问题的解决
本文介绍了如何在Spring Boot项目中集成Swagger 2.x和3.0版本,并提供了解决Swagger在Spring Boot中启动失败问题“Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerEx”的方法,包括配置yml文件和Spring Boot版本的降级。
springboot 集成 swagger 2.x 和 3.0 以及 Failed to start bean ‘documentationPluginsBootstrapper‘问题的解决
|
监控 Dubbo 搜索推荐
No application config found or it‘s not a valid config! Please add <dubbo:application name=“...“ />
No application config found or it‘s not a valid config! Please add <dubbo:application name=“...“ />
1244 1
|
Java Spring
2022年1月版IntelliJ Idea报错Could not autowire. No beans of ‘xxxx‘ type found的错误
2022年1月版IntelliJ Idea报错Could not autowire. No beans of ‘xxxx‘ type found的错误
|
5月前
|
数据库
idea整合EasyCode基于lombok和swagger自定义模板
idea整合EasyCode基于lombok和swagger自定义模板
252 0
|
5月前
|
Java 测试技术 开发工具
IntelliJ IDEA中执行@Test单元测试时报错Class not found: "..."终极办法
IntelliJ IDEA中执行@Test单元测试时报错Class not found: "..."终极办法
267 0
|
5月前
|
关系型数据库 MySQL 数据库
Mysql-错误处理: Found option without preceding group in config file
Mysql-错误处理: Found option without preceding group in config file
651 0
|
5月前
|
Dubbo 应用服务中间件
【Default config not found for ApplicationConfig】的一种解决方案
【Default config not found for ApplicationConfig】的一种解决方案
594 0
|
5月前
|
Java
SpringBoot集成swagger后出现: Failed to start bean ‘documentationPluginsBootstrapper‘的解决方法
SpringBoot集成swagger后出现: Failed to start bean ‘documentationPluginsBootstrapper‘的解决方法
167 0
|
XML Java Maven
IDEA创建Spring项目时没有Spring Config的XML文件
IDEA创建Spring项目时没有Spring Config的XML文件
588 0