当前位置:网站首页>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包并没有如愿的替换成功,别问我怎么知道;
边栏推荐
- 能源行业的数字化“新”运维
- Solve DoS attack production cases
- Simple understanding of MySQL database
- Xingnuochi technology's IPO was terminated: it was planned to raise 350million yuan, with an annual revenue of 367million yuan
- Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
- Synchronous development of business and application: strategic suggestions for application modernization
- Certains marchés de l'emploi de Shanghai refusent d'embaucher des personnes qui se rétablissent positives à Xinguan
- Binary search tree
- R language uses DT function to generate t-distribution density function data and plot function to visualize t-distribution density function data
- Tongyu Xincai rushes to Shenzhen Stock Exchange: the annual revenue is 947million Zhang Chi and Su Shiguo are the actual controllers
猜你喜欢

Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up

Actf 2022 came to a successful conclusion, and 0ops team won the second consecutive championship!!

The list of people who passed the fifth phase of personal ability certification assessment was published

业务与应用同步发展:应用现代化的策略建议
![Estimate blood pressure according to PPG using spectral spectrum time depth neural network [turn]](/img/f2/194ae452609d3e474b7b580d61bf4f.png)
Estimate blood pressure according to PPG using spectral spectrum time depth neural network [turn]
![[matlab] Simulink the input and output variables of the same module cannot have the same name](/img/99/adfe50075010916439cd053b8f04c7.png)
[matlab] Simulink the input and output variables of the same module cannot have the same name

史上超级详细,想找工作的你还不看这份资料就晚了

朗坤智慧冲刺科创板:年营收4亿 拟募资7亿

ROS custom message publishing subscription example

Problems encountered in using RT thread component fish
随机推荐
MRO industrial products enterprise procurement system: how to refine procurement collaborative management? Industrial products enterprises that want to upgrade must see!
R语言使用order函数对dataframe数据进行排序、基于单个字段(变量)进行降序排序(DESCENDING)
黑馬--Redis篇
如何提高网站权重
R language uses the order function to sort the dataframe data, and descending sorting based on a single field (variable)
Interview assault 63: how to remove duplication in MySQL?
Noninvasive and cuff free blood pressure measurement for telemedicine [translation]
Yutai micro rushes to the scientific innovation board: Huawei and Xiaomi fund are shareholders to raise 1.3 billion
The list of people who passed the fifth phase of personal ability certification assessment was published
Master Xuan joined hands with sunflower to remotely control enabling cloud rendering and GPU computing services
How are you in the first half of the year occupied by the epidemic| Mid 2022 summary
Precautions for binding shortcut keys of QPushButton
Excel 中VBA脚本的简单应用
关于静态类型、动态类型、id、instancetype
中缀表达式转后缀表达式详细思路及代码实现
Solve DoS attack production cases
Characteristic colleges and universities, jointly build Netease Industrial College
Druid 数据库连接池 详解
三面蚂蚁金服成功拿到offer,Android开发社招面试经验
Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting