SpringForAll / spring-boot-starter-swagger

自制spring boot starter for swagger 2.x,来试试吧,很好用哦~
Apache License 2.0
2.13k stars 523 forks source link

NumberFormatException #98

Closed ZerosLifeCycle closed 5 years ago

ZerosLifeCycle commented 6 years ago

开发环境 springCloudVersion=Finchley.RELEASE springBootVersion=2.0.3.RELEASE springIoVersion=Cairo-SR2

使用kotlin开发。填了基本配置,请求页面报错: java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_151] at java.lang.Long.parseLong(Long.java:601) ~[na:1.8.0_151] at java.lang.Long.valueOf(Long.java:803) ~[na:1.8.0_151] at io.swagger.models.parameters.AbstractSerializableParameter.getExample(AbstractSerializableParameter.java:395) ~[swagger-models-1.5.18.jar:1.5.18] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151] at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:687) [jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) [jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) [jackson-databind-2.9.6.jar:2.9.6]...

大概看了下是 AbstractSerializableParameter 中的 example 为空字符串

xiaodu9499 commented 6 years ago

我也遇到了,请问如何解决

ZerosLifeCycle commented 6 years ago

换低一个版本

xiaodu9499 commented 6 years ago

解决了,十分感谢😊

gongpu commented 5 years ago

换低一个版本

spring boot还是swagger?

xiaodu9499 commented 5 years ago

@gongpu swagger

JeffLi1993 commented 5 years ago
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

                 <dependency>
            <groupId>com.spring4all</groupId>
            <artifactId>swagger-spring-boot-starter</artifactId>
            <version>1.7.0.RELEASE</version>
        </dependency>

spring-boot 1.5.6.RELEASE

对应

swagger-spring-boot-starter 1.7.0.RELEASE

没问题。1.7.1 RELEASE 会有问题