Mica 官方网站

vuePress-theme-reco 如梦技术    2021
Mica 官方网站
文档
组件集
VIP
博文
友情链接
关于
GitHub

如梦技术

0

Article

9

Tag

文档
组件集
VIP
博文
友情链接
关于
GitHub
  • 认识 Mica

    • Mica 简介
    • 快速开始
    • 发行版本
  • mica工具类

    • mica-core模块说明
    • $工具集
    • SystemCode
    • ServiceException
    • Bean-validator分组
    • StringUtil
    • SystemUtil
    • BeanUtil
    • FileUtil
    • JsonUtil
    • UrlUtil
    • WebUtil
    • INetUtil
    • IoUtil
    • NumberUtil
    • ConvertUtil
    • ThreadUtil
    • PathUtil
    • HexUtil
    • AesUtil
    • DesUtil
    • RsaUtil
    • Base64Util
    • DigestUtil
    • DateUtil
    • ObjectUtil
    • ResourceUtil
    • ThreadLocalUtil
    • RuntimeUtil
    • ReflectUtil
    • ClassUtil
    • CollectionUtil
    • Unchecked(Lambda受检异常)
    • Exceptions
    • DecimalNum
    • Once
    • CountMap
    • Version
    • xpath解析xml

vuePress-theme-reco 如梦技术    2021

Bean-validator 分组


如梦技术

# Bean-validator 分组

内置了 bean-validator,需要结合 mica-boot 参数校验章节一起使用。

# 分组

  • CreateGroup
  • DeleteGroup
  • GetGroup
  • UpdateGroup

# 使用

# 模型

@Data
public class Person {
    private Long id;
    /**
     * 添加groups 属性,说明只在特定的验证规则里面起作用,不加则表示在使用Deafault规则时起作用
     */
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class})
    private String name;

    @NotNull(groups = {CreateGroup.class})
    private String address;

    // ... ...
}

# 方法

@PostMapping("register")
public void register(@Validated(CreateGroup.class) Person person) {
    // ... ...
}

# 微信 vs 公众号

如梦技术

精彩内容每日推荐!!!

编辑此页面
更新时间: 9/8/2020, 8:42:56 PM
  • 分组
  • 使用
  • 模型
  • 方法
  • 微信 vs 公众号