I've enabled spring mvc annotation driven for my project. The idea is to use @Valid
annotation with spring annotations to avoid the line in the controller like:
validator.validate(form, errors)
I've noticed that this stuff does not work with spring annotations from package:
org.springmodules.validation.bean.conf.loader.annotation.handle
After investigation I've found that I can use annotations from javax
or org.hibernate.validator.constraints
as alternative way.
But unfortunatly, I have some special cases when I cannot achieve this:
@MinSize(applyIf = "name NOT EQUALS 'default'", value = 1)
Will be good to know in which way spring annotation can be used with @Valid
or any other alternative way to avoid refactoring related to applyIf
attributes(Move conditions to java code).