作为一个后台开发,我们的项目中一般都会使用swagger,今天发现项目中使用的swagger一直提示:java.lang.NumberFormatException: For input string: ""
1.实体类使用@ApiModelProperty时,example属性没有赋值导致的
2.简单粗暴处理方法,找到pom文件,添加如下依赖

<dependency> <groupId>io.swagger</groupId> <artifactId>swagger-annotations</artifactId> <version>1.5.21</version> </dependency> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-models</artifactId> <version>1.5.21</version> </dependency>
3.运行项目,发现完美解决问题,后台不再抛出异常
浙公网安备 33010602011771号