Search code examples
springspring-roo

Spring Roo - create web scaffolding based on json controllers?


It would appear that the only way to build the default web scaffolding is with the standard web mvc controllers that are form based. Is is possible to automatically create views that use the mvc json controllers instead?


Solution

  • There are a number of ways to work with JSON document serialization and desrialization in Roo projects:

    • Option 1: Built-in JSON handling managed in domain layer (discussed in this section). This offers customizable FlexJson integration.
    • Option 2: Spring MVC detects the Jackson library in the application classpath
      • simply use Spring's @RequestBody and @ResponseBody annotations in the controllers, or
      • take advantage of Spring's ContentNegotiatingViewResolver