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. 微信公众平台网页授权登陆access_token误区

    公众平台里显示 每日获取access_token上线2000次,此access_token并非网页授权登陆的access_token大家不要混淆 1,网页授权登陆的access_token是没有上线的 ...

  2. NSSCTF-finalrce

    菜狗的我打开题目之后,人都给我吓傻了,直接过滤的超出了我的认知  菜狗直接就枯了,这个题目其实是不难的,就是比较阴间的一个题目,审计代码,可以看到最后一行的代码"exec($url)&quo ...

  3. [题解]UVA10054 The Necklace

    链接:http://vjudge.net/problem/viewProblem.action?id=18806 描述:给出一堆珠子,每个珠子有两种颜色,有一端颜色相同的珠子可以串在一起,问是否可以把 ...

  4. 如何用zabbix监控mysql多实例

    agent上起了多了 mysql实例,占用不同的端口,agent 仅在初始状况下,塞入脚本和 键配置,然后重启. 以后维护的时候(mysql端口变动),要做到 不能 动agent,力争 只在 web端 ...

  5. shell之局域网内脚本检查主机网络通讯(附并发改写)

    转至:https://blog.csdn.net/yrx420909/article/details/104355825 需求:写一个脚本,局域网内,把能ping通的IP和不能ping通的IP分类,并 ...

  6. Activity跳转显式方法及隐式方法

    1 public class AActivity extends AppCompatActivity { 2 private Button btnJump; 3 @Override 4 protect ...

  7. kibana实现条件查询和修改

    GET jyb_report_index_preprod/_search { "query": { "match": { "report_id&quo ...

  8. Windows11中如何使用旧版本IE浏览器打开网页

    Windows11删除了旧版本IE浏览器,完全采用了Edge,但是我们进行网站测试时有时仍会用到IE浏览器,那么可以按照以下步骤启用: 1.进入Edge浏览器中,打开设置,进入默认浏览器选项下: 修改 ...

  9. Jquery.Validate清除验证信息|laydate时间控件无法清除validate提示问题

    最近做一个需求,用到模态框和Jquery.Validate验证框架: 点击添加时弹出模态框,当输入数据保存时如果数据不能通过校验,则会触发Validate验证并显示提示信息: 如果此时关闭弹出层,下次 ...

  10. JZ-005-用两个栈实现队列

    用两个栈实现队列 题目描述 用两个栈来实现一个队列,完成队列的Push和Pop操作. 队列中的元素为int类型. 题目链接: 用两个栈实现队列 代码 import java.util.Stack; / ...