当前位置:网站首页>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包并没有如愿的替换成功,别问我怎么知道;
边栏推荐
- 提前解锁 2 大直播主题!今天手把手教你如何完成软件包集成?|第 29-30 期
- 快速幂模板求逆元,逆元的作用以及例题【第20届上海大学程序设计联赛夏季赛】排列计数
- Openmv4 learning notes 1 --- one click download, background knowledge of image processing, lab brightness contrast
- LeetCode-1279. Traffic light intersection
- Digital "new" operation and maintenance of energy industry
- Dark horse -- redis
- 助力安全人才专业素养提升 | 个人能力认证考核第一阶段圆满结束!
- R language uses rchisq function to generate random numbers that conform to Chi square distribution, and uses plot function to visualize random numbers that conform to Chi square distribution
- 2022.2.12
- R语言使用rchisq函数生成符合卡方分布的随机数、使用plot函数可视化符合卡方分布的随机数(Chi Square Distribution)
猜你喜欢

基于蝴蝶种类识别

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

Countdown 2 days | live broadcast preview of Tencent cloud message queue data import platform
受益匪浅,安卓面试问题

Digital "new" operation and maintenance of energy industry

LeetCode-1279. Traffic light intersection

快速幂模板求逆元,逆元的作用以及例题【第20届上海大学程序设计联赛夏季赛】排列计数

Simple understanding of MySQL database

pychrm社区版调用matplotlib.pyplot.imshow()函数图像不弹出的解决方法

Handwritten online chat system (principle part 1)
随机推荐
MRO工业品企业采购系统:如何精细化采购协同管理?想要升级的工业品企业必看!
R语言使用rchisq函数生成符合卡方分布的随机数、使用plot函数可视化符合卡方分布的随机数(Chi Square Distribution)
主从搭建报错:The slave I/O thread stops because master and slave have equal MySQL serv
On AAE
R language uses rchisq function to generate random numbers that conform to Chi square distribution, and uses plot function to visualize random numbers that conform to Chi square distribution
Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan
R语言ggplot2可视化时间序列柱形图:通过双色渐变配色颜色主题可视化时间序列柱形图
Php+redis realizes the function of canceling orders over time
R language ggplot2 visual time series histogram: visual time series histogram through two-color gradient color matching color theme
Actf 2022 came to a successful conclusion, and 0ops team won the second consecutive championship!!
Benefit a lot, Android interview questions
Interface test tool - postman
Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up
朗坤智慧冲刺科创板:年营收4亿 拟募资7亿
驼峰式与下划线命名规则(Camel case With hungarian notation)
R language uses the order function to sort the dataframe data, and descending sorting based on a single field (variable)
裕太微冲刺科创板:拟募资13亿 华为与小米基金是股东
Certains marchés de l'emploi de Shanghai refusent d'embaucher des personnes qui se rétablissent positives à Xinguan
Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
Helm deploy etcd cluster