将文档类型改成如下
swagger2.9.2会出现NumberFormatException
解决办法如下:
删除旧的swagger版本(1.5.20)并添加新的。
在pom.xml中
< 依赖 >
< groupId > io.springfox </ groupId >
< artifactId > springfox-swagger2 </ artifactId >
< version > 2.9.2 </ version >
< exclusions >
< 排除 >
< groupId > io.swagger </ groupId >
< artifactId > swagger-annotations </ artifactId >
</ exclusion >
< 排除 >
< groupId > io.swagger </ groupId >
< artifactId > swagger-models </ artifactId >
</ exclusion >
</ exclusions >
</ dependency >
< 依赖 >
< groupId > io.springfox </ groupId >
< artifactId > springfox-swagger-ui </ artifactId >
< version > 2.9.2 </ version >
</ dependency >
< 依赖 >
< groupId > io.swagger </ groupId >
< artifactId > swagger-annotations </ artifactId >
< version > 1.5.21 </ version >
</ dependency >
< 依赖 >
< groupId > io.swagger </ groupId >
< artifactId > swagger-models </ artifactId >
< version > 1.5.21 </ version >
</ dependency >
若是gradle
compile("io.springfox:springfox-swagger2:$swaggerVersion") { exclude group: 'io.swagger', module: 'swagger-annotations' exclude group: 'io.swagger', module: 'swagger-models' } compile("io.springfox:springfox-swagger-ui:$swaggerVersion") compile("io.swagger:swagger-annotations:1.5.21") compile("io.swagger:swagger-models:1.5.21")