title: custom validation messages in grails
body: <p>I have a domain constraint which I am validating like </p>
  
  <pre><code>userName(blank:false, nullable:false, Size: 5..50,matches:'^[A-Za-z\\d]*$',validator:{chkUser,user-&gt;if(user.loginService.getUser(user.organizationId,user.userName)!=null){
                                                                                                                      return[propertyName="userName"]}
                                                                                                })
  </code></pre>
  
  <p>So what I am trying to do is call login service and see if username exists. IF the username exists I have to return message USerName already exists. I have modified my message.properties as:</p>
  
  <pre><code>BuildUserNameCommand.userName.matches= Username Should have alphanumeric characters only
  BuildUserNameCommand.userName.invalid.userName=Username already exists
  BuildUserNameCommand.userName.validator.error= Username already exists
  </code></pre>
  
  <p><code>buildusernamecommand</code> is my class name. I have also tried <code>return['invalid.userName']</code> in the constraint. But still its not displaying the custom message. </p>
  
  <p>Help me out please....</p>