java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_242]

出现此错误,就是应该导入了多个版本的swagger依赖

<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>

<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>

通过IDEA提供的依赖图查看,项目中存在 1.5.20版本和2.1.2版本,需要排除1.5.20版本的依赖;解决方法如下:替换swagger的依赖包即可
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<artifactId>swagger-models</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-common</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>

因为

springfox-boot-starter:3.0 依赖导入了2个版本,所以只需要把低版本排除即可

其他问题:如果把1.5.20低版本给去掉的话,会报io.swagger.models依赖找不到
所以添加最新版1.6.2版本即可
    <dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
</dependency>

swagger快捷导航:

 1. Swagger-code 1.5.X注解

 2. Swagger-code 2.0注解(基本不可用):大部分注解的属性使用没有效果 ,如@Schema里的description属性没有通过swagger api接口返回,页面并未展示,还有其他坑

3. Swagger-Code 入门导航

Swagger2.0的注解不清楚为什么不起作用,有知道的朋友请在下方评论交流,网络上基本都是介绍Swagger1.5.X的注解

SpringBoot项目集成swagger报NumberFormatException: For input string: ""的更多相关文章

  1. SpringBoot项目集成Swagger启动报错: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is

    使用的Swagger版本是2.9.2.knife4j版本是2.0.4. SpringBoot 版本是2.6.2将SpringBoot版本回退到2.5.6就可以正常启动

  2. SpringBoot整合Swagger2案例,以及报错:java.lang.NumberFormatException: For input string: ""原因和解决办法

    原文链接:https://blog.csdn.net/weixin_43724369/article/details/89341949 SpringBoot整合Swagger2案例 先说SpringB ...

  3. maven项目中使用redis集群报错: java.lang.NumberFormatException: For input string: "7006@17006"

    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.client ...

  4. 新建SpringBoot项目运行页面报错Whitelabel Error Page This application has no explicit mapping for /error, so yo

    新建SpringBoot项目运行页面报错Whitelabel Error Page This application has no explicit mapping for /error, so yo ...

  5. hadoop ha环境下的datanode启动报错java.lang.NumberFormatException: For input string: "10m"

    hadoop ha环境启动start-dfs.sh的时候datanode启动不了,并且报错. [hadoop@datanode2 ~]$ cat /home/hadoop/hadoop-2.7.3/l ...

  6. springboot快速集成swagger

    今天技术总监说:小明,我们本次3.0改造,使用swagger2.0作为前后端分离的接口规范,它可以一键生成前后端的API,一劳永逸--小明:??? Spring Boot 框架是目前非常流行的微服务框 ...

  7. SpringBoot项目集成Hystrix

    Hystrix Hystrix是由Netflix开源的一个服务隔离组件,通过服务隔离来避免由于依赖延迟.异常,引起资源耗尽导致系统不可用的解决方案. 1.什么是服务熔断   服务熔断就是对该服务的调用 ...

  8. SpringBoot项目集成PageHelper使用

    SpringBoot项目集成PageHelper使用 一.开始 ​ 地址:https://github.com/pagehelper/Mybatis-PageHelper ​ 在spring boot ...

  9. 项目集成swagger,并暴露指定端点给swagger

    项目集成swagger 一:思考: 1.swagger解决了我们什么问题? 传统开发中,我们在开发完成一个接口后,为了测试我们的接口,我们通常会编写单元测试,以测试我们的接口的可用性,或者用postm ...

随机推荐

  1. node打标签、污点

    标签 1.查看当前节点的标签 kubectl get node --show-labels 2.给节点打标签 kubectl label node nodename key=value. 3.删除标签 ...

  2. 提高可测性-Mock平台设计和整体规划

    微信搜索[大奇测试开],关注这个坚持分享测试开发干货的家伙. 平台背景 从业务特性上,不少测试的服务很多是依赖第三方的接口的,比如其中的支付场景,就需要很多状态的返回进行验证,但大部分服务提供商没有很 ...

  3. kali linux 中python2不带pip的解决方法

    在使用kali2020版本时,发现pip只能安装python3的模块,没办法安装python2模块,但是我有需要用到python2来运行脚本,在此贴出解决办法 https://bootstrap.py ...

  4. m0n0wall安装教程

    m0n0wall的镜像链接:https://pan.baidu.com/s/1soIw7cS1Tv180fbo2655UA 提取码:dpon 一.新建虚拟机 新建虚拟机我想大家都会,详细步骤我就不陈述 ...

  5. RENIX操作之XML报文模板说明——网络测试仪实操

    我们在网络测试仪的日常使用过程中,经常涉及到编辑和修改报文.利用RENIX软件,可以把当前编辑好的报文模板导出为XML文件,下次使用时可以直接导入使用,从而提升测试工作效率.本文以"添加UD ...

  6. 5款开源BI系统倾力推荐,企业信息化的利器

    如今的企业都在选择开源BI系统,提升企业信息化的水平.那么开源BI系统到底该如何选择?在目前的百度上面有着许许多多类似的内容,本文就整理了其中优秀的5款工具,帮助大家选择合适的软件. 1.Smartb ...

  7. 大数据BI系统挖掘企业业务上的价值

    ​相信关注过我们的肯定知道BI是什么,但是老话常谈以防新朋友不知道BI的含义,BI(Business Intelligence)即商务智能,它是一套完整的解决方案,用来将企业中现有的数据进行有效的整合 ...

  8. smbms项目核心功能实现

    SMBMS 数据库: 项目如何搭建? 考虑使用不使用Maven?依赖,Jar 1.项目搭建准备工作 搭建一个maven web项目 配置Tomcat 测试项目是否能够跑起来 导入项目中会遇到的jar包 ...

  9. 服务器CPU很高-怎么办(Windbg使用坑点)

    最近,碰到了一个线上CPU服务器很高的问题,并且也相当紧急,接到这个任务后,我便想到C#性能分析利器,Windbg. 终于在折腾半天之后,找出了问题,成功解决,这里就和大家分享一下碰到的问题. 问题1 ...

  10. 2016EC Final F.Mr. Panda and Fantastic Beasts

    题目大意 \(T(1\leq T\leq42)\)组数据,给定\(n(2\leq n\leq 50000)\)个字符串\(S_{i}(n\leq\sum_{i=1}^{n}S_{i}\leq 2500 ...