Constraints provide Grails with a declarative DSL for defining validation rules, schema generation and CRUD generation meta data. For example, consider these

The above domain constraints define that username will be in range 5..15 and should be unique and in case of age it should be of min 18 etc.
Now If you don’t want to hard code min size of password then you can obtain the value of that property as

and update the min size constraint of property password on the fly as

now onward constraint on min size will be 20.We can assert this as