当前位置:网站首页>swagger2报错Illegal DefaultValue null for parameter type integer
swagger2报错Illegal DefaultValue null for parameter type integer
2022-07-06 11:24:00 【市井榴芒】
1、报错详情
今天搞开发,自动生成了一大堆javabean的代码,里面包含了swagger2的注解,结果项目启动起来一刷新swagger2就报错java.lang.NumberFormatException: For input string: ""
,其实对使用没啥影响,但是对于强迫症来说贼难受哇,下面是报错信息;
2022-07-05 14:24:53.538 WARN 55280 --- [nio-8888-exec-9] i.s.m.p.AbstractSerializableParameter : Illegal DefaultValue null for parameter type integer
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:601)
at java.lang.Long.valueOf(Long.java:803)
at io.swagger.models.parameters.AbstractSerializableParameter.getExample(AbstractSerializableParameter.java:412)
at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
2、原因分析
网上有很多介绍具体原因的,咱就不多唠了,其实就是swagger2本身的问题,不算代码的问题;
3、解决方案
既然是swagger2本身的问题,没做好优化,那最好的办法就是用优化过的swagger2,也就是把会导致报错的jar包们替换掉:
旧pom.xml文件
<!-- swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
新pom.xml文件
<!-- swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<!-- 解决swagger报错Illegal DefaultValue null for parameter type integer -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.22</version>
</dependency>
PS: 如果替换掉还是会报错,请多多重新build、启停项目、清除缓存、MAVEN构建等等操作,因为缓存会导致jar包并没有如愿的替换成功,别问我怎么知道;
边栏推荐
- [depth first search] Ji suanke: Square
- Describe the process of key exchange
- 能源行业的数字化“新”运维
- Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
- helm部署etcd集群
- Take a look at how cabloyjs workflow engine implements activiti boundary events
- php+redis实现超时取消订单功能
- Understanding disentangling in β- VAE paper reading notes
- English topic assignment (25)
- Optical blood pressure estimation based on PPG and FFT neural network [translation]
猜你喜欢
三年Android开发,2022疫情期间八家大厂的Android面试经历和真题整理
Benefit a lot, Android interview questions
同宇新材冲刺深交所:年营收9.47亿 张驰与苏世国为实控人
多线程基础:线程基本概念与线程的创建
AUTOCAD——中心线绘制、CAD默认线宽是多少?可以修改吗?
黑马--Redis篇
史上超级详细,想找工作的你还不看这份资料就晚了
How to improve website weight
openmv4 学习笔记1----一键下载、图像处理背景知识、LAB亮度-对比度
五金机电行业供应商智慧管理平台解决方案:优化供应链管理,带动企业业绩增长
随机推荐
朗坤智慧冲刺科创板:年营收4亿 拟募资7亿
Solution of commercial supply chain management platform for packaging industry: layout smart supply system and digitally integrate the supply chain of packaging industry
Helm deploy etcd cluster
Help improve the professional quality of safety talents | the first stage of personal ability certification and assessment has been successfully completed!
[translation] a GPU approach to particle physics
Characteristic colleges and universities, jointly build Netease Industrial College
Human bone point detection: top-down (part of the theory)
The dplyr package of R language performs data grouping aggregation statistical transformations and calculates the grouping mean of dataframe data
Druid 数据库连接池 详解
QPushButton绑定快捷键的注意事项
AutoCAD - what is the default lineweight for centerline drawing and CAD? Can I modify it?
AcWing 3537. Tree lookup complete binary tree
谷粒商城--分布式高级篇P129~P339(完结)
Intelligent supply chain management system solution for hardware and electromechanical industry: digital intelligent supply chain "creates new blood" for traditional industries
openmv4 学习笔记1----一键下载、图像处理背景知识、LAB亮度-对比度
Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan
Certains marchés de l'emploi de Shanghai refusent d'embaucher des personnes qui se rétablissent positives à Xinguan
A wearable arm device for night and sleeveless blood pressure measurement [translation]
Master Xuan joined hands with sunflower to remotely control enabling cloud rendering and GPU computing services
wx小程序学习笔记day01