title: Rendering GORM classes from Spring Boot
body: <p>I'm trying to write a simple Spring Boot controller that renders a GORM instance and failing.</p>
  
  <p>Here's a shortened version of my code:</p>
  
  <pre><code>@RestController
  @RequestMapping("/user")
  class UserController {
      @RequestMapping(value='/test', method=GET)
      User test() {
          return new User(username: 'my test username')
      }
  }
  </code></pre>
  
  <p>I get the following error message: </p>
  
  <p><code>Could not write JSON: No serializer found for class org.springframework.validation.DefaultMessageCodesResolver and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: users.domain.User["errors"]-&gt;grails.validation.ValidationErrors["messageCodesResolver"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.springframework.validation.DefaultMessageCodesResolver and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: users.domain.User["errors"]-&gt;grails.validation.ValidationErrors["messageCodesResolver"])</code></p>
  
  <p>The error seems to be caused by extra properties injected by GORM. What is the proposed solution for this? Will this eventually be solved in <code>gorm-hibernate4-spring-boot</code>? Should I simply disable <code>SerializationFeature.FAIL_ON_EMPTY_BEANS</code> (I don't have a lot of experience with Jackson so I'm not entirely sure what side effects this may have)? Should I use Jackson's annotations to solve the problem? Any other options?</p>