您当前的位置: 首页 >  spring

梁云亮

暂无认证

  • 1浏览

    0关注

    1211博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

SpringBoot整合Swagger启动报警告

梁云亮 发布时间:2021-07-17 11:24:48 ,浏览量:1

错误

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;
    }
关注
打赏
1665409997
查看更多评论
立即登录/注册

微信扫码登录

0.0452s