報錯: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>