We can easily validate domain classes and command objects using static constraints. But how about validating DTOs or any groovy class in src/groovy folder.
The answer is YES, they can be validated too. Follow two simple steps:
1. Add annotation ‘@Validateable’ above the class.
2. Declare the package to be validated in Config.groovy as:
grails.validateable.packages = ['com.mycompany.dto']
Click here to read complete documentation.
I wish I knew this earlier. Grails rocks!!