错误
SpringBoot整合Swagger,在启动项目的时候,启动日志中报了一个警告信息Unable to interpret the implicit parameter configuration with dataType: Integer, dataTypeClass: class java.lang.Void
,如下图所示: 这是因为Swagger中的注解@ApiImplicitParam有一个属性为dataTypeClass,该属性的默认值为Void.class,因为没有指定dataTypeClass属性的值,所以报该警告信息。
在@ApiImplicitParam注解上加上dataTypeClass属性的值,例如:
@PostMapping("/fun")
@ApiOperation(value = "修改部门地址", notes = "根据部门编号修改部门地址")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "deptno", value = "部门ID", required = true, dataType = "Integer",dataTypeClass = Integer.class),
@ApiImplicitParam(paramType = "query", name = "dname", value = "部门名称", required = true, dataType = "String",dataTypeClass = String.class),
@ApiImplicitParam(paramType = "query", name = "loc", value = "部门地址", required = true, dataType = "String",dataTypeClass = String.class)
})
public List fun(@RequestParam(value = "deptno") Integer deptno,
@RequestParam(value = "dname") String dname,
@RequestParam(value = "loc") String loc) {
return null;
}