8. Scaffolding a Spring MVC application from domain object


There are several layers to a Spring MVC application, and there are many Spring, JPA, and Java artifacts needed to implement those layers. The Skyway Builder Spring DSL simplifies the development of these artifacts through the use of code generation, but there is also an opportunity to generate full applications. Other development platforms, including RAILS and GRAILS, have popularized this approach to application development. Scaffolding consists of generating full applications by applying standard application patterns from a minimal set of inputs provided by the developer. Whether these scaffolded applications are used as-is or as the starting point for additional developer customization, scaffolding is very effective at jump-starting application development.


Spring MVC scaffolding consists of generating a full Spring MVC application based on the CRUD application pattern. By only defining the domain model, which can consist of one or more related domain objects, the Spring MVC scaffolding engine will create all the web, service, and data layer components for managing the domain objects, including create, read, update and delete.

Starting with a domain object, here's what gets created by Spring MVC scaffolding:

Spring MVC Scaffolding

  1. a model package for the data access object layer

  2. a data access object (DAO)

  3. a set of named queries (JPQL) for the domain object

  4. a model package for the service layer

  5. a Service with CRUD operations

  6. a model package for the controller layer

  7. a Controller with fully implemented CRUD operations

  8. Junits for controllers and

  9. layout managed user interface using Sitemesh

  10. CRUD JSP pages using Spring Form tag library and JSTL

  11. client-side validation implemented Spring JS with DOJO

  12. integration with Spring Security, including a default DB implementation of users and authorities


Before scaffolding an application the developer must create or import the domain model using the Spring DSL, and the domain model must be contained within a Model Pacakge.

Here are the steps for using the Spring MVC scaffolding:

Steps for scaffolding a domain object:

  1. Right-click on a domain object, and select Scaffolding --> Generate CRUD


  1. Scaffolding Spring Security