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 ...
随机推荐
- 商业智能BI不仅仅是报表工具,它的真正价值是:决策支持
作为一个独立系统,商业智能BI解决两个问题.一是信息的发布,它可以在正确的时间向正确的人提供正确的信息.几十年来,我们看到的商业智能项目,至少有90%的项目成果变成了提供信息的报告.这种情况下,改变的 ...
- 打破刻板印象,了解真正的商业智能BI
在技术飞速发展的过程中,人们越来越怀疑传统的数据分析方法.可以通过对商业智能的各种误解来解释这一点,如今,这种误解正在作为有效的真理传播.例如,数据仓库已达到其目标.而数据质量似乎也正在失去其相关性 ...
- BI工具是什么,有什么用,怎么用?
BI工具是什么,有什么用,怎么用?这应该是很多刚刚接触BI工具的读者最开始想了解的问题,经常在看到数据可视化.数据分析.数据仓库和大数据等词汇时会有的摸不着头脑,本次小编就围绕BI工具是什么,有什么用 ...
- 为什么DRAM采用地址复用技术?为什么SRAM不采用地址复用技术?
行列地址复用:比如你的存储器容量是16bit,那么可以将这16个比特组织成一个4*4的矩阵,为了找到某个你想要找的bit,比如第1行第2列的那个bit.你先发送二进制的01,表示要找的数据在第1行:接 ...
- c# TabControl控件中TabPage选项卡切换时触发的事件
选项卡切换触发的是tabcontrol控件的SelectedIndexChanged事件. 当tabcontrol控件的任何一个tabpage被点击或选择,即发生SelectedIndexChange ...
- 任意文件夹打开CMD命令窗口
1:打开任意文件夹 2:按住Shift键,鼠标右键单击 3:该文件夹下的命令窗口已打开,方便快捷
- Linux CentOS7.X-目录操作命令
一.安装vim 由于安装Centos7MINI版本里面没有vim命令,只有vi命令,所以安装vim命令,默认系统只带了vim-minimal.x86_64包,需要安装其他的3个包才能用vim命令 1. ...
- 联邦学习:按混合分布划分Non-IID样本
我们在博文<联邦学习:按病态独立同分布划分Non-IID样本>中学习了联邦学习开山论文[1]中按照病态独立同分布(Pathological Non-IID)划分样本. 在上一篇博文< ...
- 矩池云利用ipykernel为JupyterLab添加kernel以及展示出来
source activate myconda pip install ipykernel python -m ipykernel install --user --name myconda --di ...
- PHP魔术方法11种
1.构造函数:__construct(): 构造函数是类中的一个特殊函数,当我们使用new关键字实例化对象时,相当于调用了类的构造函数. function __construct($name){ $t ...