Loading
0

Lombok中@Data注解不生成指定的getter/setter

注解中加上AccessLevel.NONE,如下:

@Data
public class HcLoginResponse {

    private String token;

    @Getter(AccessLevel.NONE)
    @Setter(AccessLevel.NONE)
    private AuthType authType;

    public HcLoginResponse(AuthType authType) {
        this.authType = authType;
    }

}

最后编辑于:2020/4/28作者: joycode

评论已关闭