出现原因
是因为swagger文档上每个参数都会设定一个默认值,包装类型的默认值是"",所以会出现转换异常。
解决方案
方案一
在@ApiModelProperty设定默认值
方案二
降低 springfox-swagger2 包中 swagger-annotations 和 swagger-models 的版本号
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<exclusions>
<!--屏蔽旧版本的swagger-annotations-->
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<!--屏蔽旧版本的swagger-models-->
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--引入指定版本的swagger-annotations和swagger-models解决出现加载swagger时候For input string: ““问题-->
<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>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.6</version>
</dependency>
1474

被折叠的 条评论
为什么被折叠?



