swagger报java.lang.NumberFormatException

匿名 (未验证) 提交于 2019-12-02 21:35:18

原因:

在使用@ApiModelProperty的时候有个example属性,如果没设置默认值,会自动赋值""空字符串,导致整型数据赋值有问题

解决办法:

修改maven依赖:

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

文章来源: https://blog.csdn.net/weixin_39841589/article/details/90286765
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!