SpringBoot项目集成swagger报NumberFormatException: For input string: ""
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快捷导航:
2. Swagger-code 2.0注解(基本不可用):大部分注解的属性使用没有效果 ,如@Schema里的description属性没有通过swagger api接口返回,页面并未展示,还有其他坑
3. Swagger-Code 入门导航
Swagger2.0的注解不清楚为什么不起作用,有知道的朋友请在下方评论交流,网络上基本都是介绍Swagger1.5.X的注解
SpringBoot项目集成swagger报NumberFormatException: For input string: ""的更多相关文章
- 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就可以正常启动
- SpringBoot整合Swagger2案例,以及报错:java.lang.NumberFormatException: For input string: ""原因和解决办法
原文链接:https://blog.csdn.net/weixin_43724369/article/details/89341949 SpringBoot整合Swagger2案例 先说SpringB ...
- maven项目中使用redis集群报错: java.lang.NumberFormatException: For input string: "7006@17006"
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.client ...
- 新建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 ...
- 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 ...
- springboot快速集成swagger
今天技术总监说:小明,我们本次3.0改造,使用swagger2.0作为前后端分离的接口规范,它可以一键生成前后端的API,一劳永逸--小明:??? Spring Boot 框架是目前非常流行的微服务框 ...
- SpringBoot项目集成Hystrix
Hystrix Hystrix是由Netflix开源的一个服务隔离组件,通过服务隔离来避免由于依赖延迟.异常,引起资源耗尽导致系统不可用的解决方案. 1.什么是服务熔断 服务熔断就是对该服务的调用 ...
- SpringBoot项目集成PageHelper使用
SpringBoot项目集成PageHelper使用 一.开始 地址:https://github.com/pagehelper/Mybatis-PageHelper 在spring boot ...
- 项目集成swagger,并暴露指定端点给swagger
项目集成swagger 一:思考: 1.swagger解决了我们什么问题? 传统开发中,我们在开发完成一个接口后,为了测试我们的接口,我们通常会编写单元测试,以测试我们的接口的可用性,或者用postm ...
随机推荐
- k8s中prometheus监控k8s外mysql
k8s外安装mysql https://www.cnblogs.com/uncleyong/p/10739530.html 配置MySQL Exporter采集MySQL监控数据 创建yaml文件:v ...
- Another app is currently holding the yum lock解决方法
用yum安装包有时候会提示 ``` Another app is currently holding the yum lock; waiting for it to exit... The oth ...
- SaccadeNet:使用角点特征进行two-stage预测框精调 | CVPR 2020
SaccadeNet基于中心点特征进行初步的目标定位,然后利用初步预测框的角点特征以及中心点特征进行预测框的精调,整体思想类似于two-stage目标检测算法,将第二阶段的预测框精调用的区域特征转化为 ...
- Python 中的闭包和自由变量
1.定义 在函数内部再定义一个函数,并且这个函数用到了外部函数的变量(LEGB),最后返回新建函数的函数名索引,那么将这样的能够访问其定义时所在的作用域的函数以及用到的一些变量称之为闭包.被引用的非全 ...
- centos7 配置 zabbix 3 & apache , nginx 与php, mysql 的交互(基本)
#yum install -y https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-server-mysql-3.0.0 ...
- 查询性能提升3倍!Apache Hudi 查询优化了解下?
从 Hudi 0.10.0版本开始,我们很高兴推出在数据库领域中称为 Z-Order 和 Hilbert 空间填充曲线的高级数据布局优化技术的支持. 1. 背景 Amazon EMR 团队最近发表了一 ...
- Python:Excel
xlrd与xlwt:xls文件 如果不想看前半部分的基础知识,可以直接看最后的总结部分 1.两个模块 读xlrd 写xlwt import xlrd,xlwt 2.读 2.1 文件.表格信息的获取 打 ...
- (转载)虚拟化(1):进程概述(The Process)
转自:https://zhuanlan.zhihu.com/p/37917981 这一章主要是对如下问题的解释. 1.Process(进程)是什么? 简单说process就是一个运行中的程序. 2.怎 ...
- 爬虫之Beautfulsoup模块及新闻爬取操作
今日内容概要 IP代理池的概念及使用 requests其他方法补充 Beautifulsoup模块 避免你自己写正则表达式 利用该模块爬取京东的商品信息 今日内容详细 IP代理池的概念及使用 1.有很 ...
- 使用 kubebuilder 创建并部署 k8s-operator
一.准备 本文中的示例运行环境及相关软件版本如下: Kubernetes v1.16.3 Go 1.15.6 Kubebuilder 3.1.0 Docker 20.10.7 安装kubebuilde ...