当前位置:网站首页>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包并没有如愿的替换成功,别问我怎么知道;
边栏推荐
- 包装行业商业供应链管理平台解决方案:布局智慧供应体系,数字化整合包装行业供应链
- Mathematical knowledge -- code implementation of Gaussian elimination (elementary line transformation to solve equations)
- Characteristic colleges and universities, jointly build Netease Industrial College
- Sanmian ant financial successfully got the offer, and has experience in Android development agency recruitment and interview
- 全套教学资料,阿里快手拼多多等7家大厂Android面试真题
- R language uses the order function to sort the dataframe data, and descending sorting based on a single field (variable)
- 抽象类与抽象方法
- PMP每日一练 | 考试不迷路-7.6
- Graffiti intelligence is listed on the dual main board in Hong Kong: market value of 11.2 billion Hong Kong, with an annual revenue of 300 million US dollars
- The second day of rhcsa study
猜你喜欢

AUTOCAD——中心线绘制、CAD默认线宽是多少?可以修改吗?

Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan

Wx applet learning notes day01

ACTF 2022圆满落幕,0ops战队二连冠!!

LeetCode-1279. Traffic light intersection

提前解锁 2 大直播主题!今天手把手教你如何完成软件包集成?|第 29-30 期

第五期个人能力认证考核通过名单公布

五金机电行业智能供应链管理系统解决方案:数智化供应链为传统产业“造新血”

全套教学资料,阿里快手拼多多等7家大厂Android面试真题

Helm deploy etcd cluster
随机推荐
C#/VB. Net to add text / image watermarks to PDF documents
Airiot IOT platform enables the container industry to build [welding station information monitoring system]
Help improve the professional quality of safety talents | the first stage of personal ability certification and assessment has been successfully completed!
Pytorch common loss function
Handwritten online chat system (principle part 1)
提前解锁 2 大直播主题!今天手把手教你如何完成软件包集成?|第 29-30 期
pychrm社区版调用matplotlib.pyplot.imshow()函数图像不弹出的解决方法
Understanding disentangling in β- VAE paper reading notes
朗坤智慧冲刺科创板:年营收4亿 拟募资7亿
黑马--Redis篇
R语言ggplot2可视化时间序列柱形图:通过双色渐变配色颜色主题可视化时间序列柱形图
应用使用Druid连接池经常性断链问题分析
wx小程序学习笔记day01
中缀表达式转后缀表达式详细思路及代码实现
Noninvasive and cuff free blood pressure measurement for telemedicine [translation]
A method of removing text blur based on pixel repair
如何提高网站权重
A wearable arm device for night and sleeveless blood pressure measurement [translation]
ModuleNotFoundError: No module named ‘PIL‘解决方法
Synchronous development of business and application: strategic suggestions for application modernization