Saturday, September 28, 2013

Spring by Example (1.3)


The site has been updated to use Spring Framework 3.2.x. The Contact Application has been updated to reference SBE REST Modules, which I will write about shortly (available on Spring by Example's GitHub). The modules are to help abstract some of the REST classes in the Contact Application and also to allow annotations on an interface to generate the REST client & controller. Two smaller items are that the Contact Application has a better example of a production ready DB connection pool configuration, and it's using Jackson 2.0 for JSON. Below are the Contact Application modules.
  • DAO - DB Schema, JPA Entities, Spring Data JPA repositories.
  • Web Service Beans - JAXB beans generated from XSDs.
  • Services - APIs use JAXB beans and Dozer is used to convert between this beans and the JPA entities. Security and transactions are configured in this layer.
  • REST Services - The module has clients & controllers, as well as their Spring configurations. JSON and XML views are supported for requests.
  • Webapp - The webapp as a standard JSP UI, Sencha ExtJS, and also a Sencha Touch UI.
  • Test - The DAO, Services, and REST Services all have an abstract test class for each module that each test extends. This way within each module, all tests have a shared context so Spring only has to load once. All of these tests use an in memory database and the REST Services have an embedded jetty server. REST Services tests can be run with clients using JSON or XML for marshalling.