【Bug】SpringCloudAlibaba整合Swagger时 启动报错

简介: 【Bug】SpringCloudAlibaba整合Swagger时 启动报错

报错

2559a86574ea43fa97291ae8e2db4a5d.png

Description:

Parameter 2 of constructor in springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander required a bean of type 'springfox.documentation.spi.schema.EnumTypeDeterminer' that could not be found.

Action:

Consider defining a bean of type 'springfox.documentation.spi.schema.EnumTypeDeterminer' in your configuration.


问题背景

在SpringCloud Alibaba整合swagger2时,启动时报以上错误。

            <!--swagger2-->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger.version}</version>
            </dependency>

image.png

版本是2.7.0

问题原因

是因为swagger2版本太低导致的问题

解决方案

版本改为:<version>2.9.2</version>

相关文章
Swagger问题:No mapping for GET /swagger-ui.html报错
Swagger问题:No mapping for GET /swagger-ui.html报错
1650 0
|
前端开发 Java Spring
SpringBoot2.6.x 整合swagger3.0 报错Failed to start bean ‘documentationPluginsBootstrapper‘
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
16467 3
SpringBoot2.6.x 整合swagger3.0 报错Failed to start bean ‘documentationPluginsBootstrapper‘
|
前端开发 Java Spring
【非降版本解决】高版本Spring boot Swagger 报错解决方案
【非降版本解决】高版本Spring boot Swagger 报错解决方案
1186 3
|
JSON Java 数据格式
【异常处理】关于访问swagger-ui报错java.lang.NumberFormatException: For input string: ““的解决方案总结
【异常处理】关于访问swagger-ui报错java.lang.NumberFormatException: For input string: ““的解决方案总结
1803 0
|
SpringCloudAlibaba Java
springcloud Alibaba 2021.0.1.0 springboot 2.7.0 整合 Swagger3.0 报错解决方案
springcloud Alibaba 2021.0.1.0 springboot 2.7.0 整合 Swagger3.0 报错解决方案
907 0
|
Java 数据格式
Swagger报错:missed comma between flow collection entries
Swagger报错:missed comma between flow collection entries
559 0
|
11月前
|
JSON Java API
微服务——SpringBoot使用归纳——Spring Boot集成 Swagger2 展现在线接口文档——Swagger2 的使用
本文详细介绍了Swagger2的使用方法,包括在Spring Boot项目中的配置与应用。重点讲解了Swagger2中常用的注解,如实体类上的`@ApiModel`和`@ApiModelProperty`,Controller类上的`@Api`、`@ApiOperation`以及参数上的`@ApiParam`等。通过示例代码展示了如何为实体类和接口添加注解,并在页面上生成在线接口文档,实现接口测试。最后总结了Swagger的优势及其在项目开发中的重要性,提供了课程源代码下载链接供学习参考。
809 0
微服务——SpringBoot使用归纳——Spring Boot集成 Swagger2 展现在线接口文档——Swagger2 的使用
|
11月前
|
缓存 Java API
微服务——SpringBoot使用归纳——Spring Boot集成 Swagger2 展现在线接口文档——Swagger2 的配置
本文介绍了在Spring Boot中配置Swagger2的方法。通过创建一个配置类,添加`@Configuration`和`@EnableSwagger2`注解,使用Docket对象定义API文档的详细信息,包括标题、描述、版本和包路径等。配置完成后,访问`localhost:8080/swagger-ui.html`即可查看接口文档。文中还提示了可能因浏览器缓存导致的问题及解决方法。
1193 0
微服务——SpringBoot使用归纳——Spring Boot集成 Swagger2 展现在线接口文档——Swagger2 的配置