1、异常
在浏览器上打开Swagger UI的主界面 http://localhost:8181/swagger-ui.html#/ 时报如下异常:
java.lang.NumberFormatException: For input string: ""
2、解决办法:
在pom.xml文件中添加如下依赖即可:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
添加以后所有的swagger依赖如下:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</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>