illegal defaultvalue null for paramter type integer

2023-12-22 12:58

本文主要是介绍illegal defaultvalue null for paramter type integer,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、问题

swagger2报错illegal defaultvalue null for paramter type integer

二、解决办法

正常swagger2引入

<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version>
</dependency>

修改依赖,覆盖默认的版本

<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version><exclusions><exclusion><groupId>io.swagger</groupId><artifactId>swagger-models</artifactId></exclusion></exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-models -->
<dependency><groupId>io.swagger</groupId><artifactId>swagger-models</artifactId><version>1.5.21</version>
</dependency>

三、异常分析

异常信息可以看到关于swagger的堆栈信息

at io.swagger.models.parameters.AbstractSerializableParameter.getExample(AbstractSerializableParameter.java:412)

点进去看之后,代码如下,默认引入1.5.20的包:

图片

注解的 example 默认值都是空字符串 "" ,包括ApiParam、ApiModelProperty、ApiImplicitParam等,经过上面的参数解析,null判断继续运行,执行xx.valueOf(),会打印警告

图片

1.5.21版本的如下,做了空值判断:

图片

github 同样的问题:

https://github.com/springfox/springfox/issues/2528

https://github.com/swagger-api/swagger-core/issues/2783

这篇关于illegal defaultvalue null for paramter type integer的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/524018

相关文章

mybatis和mybatis-plus设置值为null不起作用问题及解决

《mybatis和mybatis-plus设置值为null不起作用问题及解决》Mybatis-Plus的FieldStrategy主要用于控制新增、更新和查询时对空值的处理策略,通过配置不同的策略类型... 目录MyBATis-plusFieldStrategy作用FieldStrategy类型每种策略的作

解决Spring运行时报错:Consider defining a bean of type ‘xxx.xxx.xxx.Xxx‘ in your configuration

《解决Spring运行时报错:Considerdefiningabeanoftype‘xxx.xxx.xxx.Xxx‘inyourconfiguration》该文章主要讲述了在使用S... 目录问题分析解决方案总结问题Description:Parameter 0 of constructor in x

Oracle type (自定义类型的使用)

oracle - type   type定义: oracle中自定义数据类型 oracle中有基本的数据类型,如number,varchar2,date,numeric,float....但有时候我们需要特殊的格式, 如将name定义为(firstname,lastname)的形式,我们想把这个作为一个表的一列看待,这时候就要我们自己定义一个数据类型 格式 :create or repla

Caused by: org.hibernate.MappingException: Could not determine type for: org.cgh.ssh.pojo.GoodsType,

MappingException:这个主要是类映射上的异常,Could not determine type for: org.cgh.ssh.pojo.GoodsType,这句话表示GoodsType这个类没有被映射到

Cannot read property ‘length‘ of null while opening vscode terminal

同一问题地址:Cannot read property ‘length’ of null while opening vscode terminal 问题描述 One day, 我在ubuntu 18.04下用vscode打开一个项目,并想和往常一样在vscode使用终端,发现报错Cannot read property 'length' of null。 解决 打开setting.jso

非空约束(Not Null)

修改表添加非空约束 使用DDL语句添加非空约束 ALTER TABLE 表名 MODIFY 列名 类型 NOT NULL; 示例: 向emp表中的salary添加非空约束。 alter table emp modify salary float(8,2) not NULL; 删除非空约束 使用DDL语句删除非空约束 ALTER TABLE 表名 MODIFY 列名 类型 NULL;

FORM的ENCTYPE=multipart/form-data 时request.getParameter()值为null问题的解决

此情况发生于前台表单传送至后台java servlet处理: 问题:当Form需要FileUpload上传文件同时上传表单其他控件数据时,由于设置了ENCTYPE=”multipart/form-data” 属性,后台request.getParameter()获取的值为null 上传文件的参考代码:http://www.runoob.com/jsp/jsp-file-uploading.ht

Java中Map取值转String Null值处理

Map<String, Object> 直接取值转String String value = (String)map.get("key") 当map.get(“key”)为Null值时会报错。 使用String类的valueOf静态方法可以解决这个问题 String value = String.valueOf(map.get("key"))

NULL 輸出情況

NULL值 輸出情況區分 匯總圖片 select 空 param1 -> param1:null select param1 from 空 —> param1:空 NULL 值出現在查詢結果中 只能由 SELELCT 和 聚合函數 產生 而不是 LIMIT WHERE HAVING FROM 語句 REFERENCE Leetcode 解析

王立平--AES加密图片实现 SkImageDecoder::Factory return null

这个问题是在加密图片,存入sd卡,在解密出来展示,出现的。我个人研究了很久没解决。最后经过高人指点,终于解决了。 在此,拿出来分享,希望各位少走弯路。 我之前的设计思路是:(可以不看哦) 1.把图片从drawable读入成bitmap 2.bitmap-->byte 3.调用AES的byte加密算法。 4.加密成byte,在转化为string 5,把string存入sd卡。