原因
@ApiModelProperty(value = "当前页码")
@NotNull(message = "不能为空")
private Integer pageNum;
@ApiModelProperty(value = "每页数量")
@NotNull(message = "不能为空")
private Integer pageSize;
swagger注解中因为ApiModelProperty默认为"",即为String类型的。会被转化成Integer类型
解决方案1
@ApiModelProperty(value = "每页数量", example = "1")
标注默认示例是1,这样就不会是null
解决方案2(推荐)
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.22</version>
</dependency>
添加上述两个包,就可以解决问题