美文网首页
解决io.swagger.models.parameters.A

解决io.swagger.models.parameters.A

作者: 茶还是咖啡 | 来源:发表于2021-03-31 14:43 被阅读0次

    原因大概是这样的:
    由于实体类使用@ApiModelProperty时,example属性没有赋值导致的,在AbstractSerializableParameter的getExample方法中会将数值属性的example的转换数值类返回,example的默认值是"",因此当example没有赋值时,会出现上面的异常

    很多解决办法是添加默认值,参考链接:https://blog.csdn.net/weixin_44096448/article/details/102542068

    如果不想添加默认值,可以替换老版本的model替换原有的model模块

            <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>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>2.9.2</version>
            </dependency>
            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-models</artifactId>
                <version>1.5.21</version>
            </dependency>
    
    

    相关文章

      网友评论

          本文标题:解决io.swagger.models.parameters.A

          本文链接:https://www.haomeiwen.com/subject/zaoohltx.html