程子的博客

想得到从未得到的东西,就要去做从未做过的事

aaaaa
  menu
47 文章
23633 浏览
0 当前访客
ღゝ◡╹)ノ❤️

i.s.models.parameters.AbstractSerializableParameter.getExample:421 - Illegal DefaultValue for parameter type integer

1. 问题描述:

项目中配置 swagger2 2.9.2 , 启动项目, 当访问 swagger-ui.html 页面时, 服务器抛异常:

io.swagger.models.parameters.AbstractSerializableParameter [421] -| 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.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)

2. 解决办法:

<swagger-models.version>1.5.22</swagger-models.version>
<swagger2.version>2.9.2</swagger2.version>
       <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${swagger2.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${swagger2.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>io.swagger</groupId>
                    <artifactId>swagger-models</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-models</artifactId>
            <version>${swagger-models.version}</version>
        </dependency>


标题:i.s.models.parameters.AbstractSerializableParameter.getExample:421 - Illegal DefaultValue for parameter type integer
作者:chengzime
地址:https://chengzime.com.cn/articles/2020/11/11/1605081126891.html