Java 开源 Spring 对象校验库 Mines

码农软件 · 软件分类 · Java开发工具 · 2019-11-06 12:58:13

软件介绍

Mines - Java 开源 Spring 对象校验库

Mines 是由 Java 语言实现的 Spring 对象校验插件库,内部校验基于 Oval 实现,基于 Oval 封装的原因是该框架开源并且功能强大,同时支持JSR-303。

Minos 特点:

  • 1.基于成熟的对象校验框架Oval

  • 2.遵循JSR-303 对象校验标准

  • 3.使用简单方便,可插拔

  • 4.基于注解

由于目前Minos 还没有提交到Maven center 所以用户需自行从 Github 下载代码并编译

使用范例

在spring 配置中定义插件

<bean id="validator" class="com.minos.Validator"/>

定义需要校验的bean

public class ValidateBeanTest{

   
    
    @NotBlank(message = "名称不能为空")
    private String name;
   
    @NotBlank(message = "开始生效日期不能为空")
    private Date startDate;
   
    @NotBlank(message = "结束生效日期不能为空")
    private Date endDate;
	
	//此处 get set 方法忽略
	
}

关于Oval 基于注解校验规则使用方法请参考

在需要校验的方法上定义Validator注解

import com.minos.core.annotations.Validator;
import net.sf.oval.constraint.NotEmpty;

public class ValidatorTest {


    @Validator
    public String test(ValidateBeanTest beanTest){
        return "";
    }

}

若对本软件库感兴趣或者有什么好的意见 欢迎大家发邮件到 daishenglei@foxmail.com ,谢谢

本文地址:https://codercto.com/soft/d/18392.html

Beginning iPhone and iPad Web Apps

Beginning iPhone and iPad Web Apps

Chris Apers、Daniel Paterson / Apress / 2010-12-15 / USD 39.99

It seems that everyone and her sister has developed an iPhone App—everyone except you, the hard-working web professional. And now with the introduction of the iPad, you may even feel farther behind. B......一起来看看 《Beginning iPhone and iPad Web Apps》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具