Skip to content

Instantly share code, notes, and snippets.

@Igosuki
Created June 13, 2012 12:23
Show Gist options
  • Save Igosuki/2923741 to your computer and use it in GitHub Desktop.
Save Igosuki/2923741 to your computer and use it in GitHub Desktop.
Validating POJOs in Grails
grailsApplication.config.grails.validateable.classes.each {
ValidationGrailsPlugin.addValidationMethods(grailsApplication, this.class.forName(it), null)
}
Example :
public class Bean {
@javax.validation.constraints.NotNull
private Long id;
@org.hibernate.validator.constraints.NotBlank
private String text;
//set...get...
}
And it just works ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment