使用swagger2-2.9.2版本的问题


报错:java.lang.NumberFormatException: For input string: ""
 
因为 2.9.2中默认使用的是 swagger-models-1.5.20 版本,该版本中的example只判断了值是否为空,但是并没有判断值是否是空串,
映射上就会报 NumberFormatException 异常
 
解决方式:
排除swagger2中 swagger-models-1.5.20 版本的依赖,
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
手动添加 1.5.21 版本,该版本已解决 只判断 null 不判断 “”的问题
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM