当前位置:网站首页>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包并没有如愿的替换成功,别问我怎么知道;
边栏推荐
- Abstract classes and abstract methods
- Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting
- The list of people who passed the fifth phase of personal ability certification assessment was published
- 第五期个人能力认证考核通过名单公布
- Based on butterfly species recognition
- On AAE
- 上海部分招工市場對新冠陽性康複者拒絕招錄
- Leetcode topic [array] - 119 Yang Hui triangle II
- 渲大师携手向日葵,远控赋能云渲染及GPU算力服务
- Noninvasive and cuff free blood pressure measurement for telemedicine [translation]
猜你喜欢

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

Interface test tool - postman

A method of removing text blur based on pixel repair

Solve DoS attack production cases

helm部署etcd集群

Handwritten online chat system (principle part 1)

应用使用Druid连接池经常性断链问题分析

openmv4 学习笔记1----一键下载、图像处理背景知识、LAB亮度-对比度

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

PMP每日一练 | 考试不迷路-7.6
随机推荐
渲大师携手向日葵,远控赋能云渲染及GPU算力服务
ModuleNotFoundError: No module named ‘PIL‘解决方法
The nearest library of Qinglong panel
Qlabel marquee text display
能源行业的数字化“新”运维
朗坤智慧冲刺科创板:年营收4亿 拟募资7亿
Mathematical knowledge -- code implementation of Gaussian elimination (elementary line transformation to solve equations)
A method of removing text blur based on pixel repair
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
Deep circulation network long-term blood pressure prediction [translation]
黑马--Redis篇
Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting
Tensorflow and torch code verify whether CUDA is successfully installed
Simple understanding of MySQL database
Binary search tree
Analysis of frequent chain breaks in applications using Druid connection pools
Handwritten online chat system (principle part 1)
On AAE
When visual studio code starts, it prompts "the code installation seems to be corrupt. Please reinstall." Solution to displaying "unsupported" information in the title bar
Multithreading Basics: basic concepts of threads and creation of threads