[英]How to validate that date in future in reference to another date?
I have following bean: 我有以下bean:
class CampaignBeanDto {
@Future
Date startDate;
Date endDate;
...
}
Obviously I that endDate
should be after startDate. 显然我的endDate
应该在startDate之后。 I want to validate it. 我想验证它。
I know that I can manually realize annotation for @FutureAfterDate
, validator for this and initialize threshold date manually but I want to use @Validated
spring mvc annotation. 我知道我可以手动实现@FutureAfterDate
注释,验证器并手动初始化阈值日期,但我想使用@Validated
spring mvc注释。
How can I achieve it? 我怎样才能实现它?
You're gonna have to bear down and write yourself a Validator. 你将不得不忍住并为自己写一个验证者。
This should get you started: 这应该让你开始:
Cross field validation with Hibernate Validator (JSR 303) 使用Hibernate Validator进行交叉字段验证(JSR 303)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.