These simple examples demonstrate the basic features of Spring-MVC using both pre-2.0 XML based configuration style and the latest Spring 3.x annotation-driven style.
This section also demonstrates basic JSON enabled web services using both a pre-RESTful query parameter-based style with Spring 1.2.x and a RESTful web services style with Spring 3.x.
- hello-spring-mvc - Bare minimum Spring MVC application using a JSP view with JSTL support.
- multi-action-controller-example - Simple web application using MultiActonController.
- json-view-example - Render JSON responses using a Jackson-based JSON marshalling view.
- json-binding-example - Bind HTTP POST data to model objects using a JSON HTTP request reader.
- spring3-example - A modern Spring-MVC application using autowiring and MVC annotations (@Controller, @RequestMapping, etc.)
- spring3-json-example - Example web application and RESTful JSON web service built using the built-in Jackson object mapping support in Spring 3.
The examples are based on a simple library application that can add then edit a single book.
Figure 1: Library Application State Diagram
The JSON examples include sample RESTClient requests in the src/test/resources folder that can be used to test sending JSON data to and retrieving data from the JSON web service. The sample requests assume that the application server is running on port 8080, so may need to be modified for your development environment.
These more advanced examples demonstrate backing a RESTful web service with an ORM persistence layer using Hibernate and adding fast full-text search using Hibernate Search and Lucene.
This section also demonstrates pure static HTML / Ajax client applications that consume these RESTful web services using raw XmlHttpRequest as well as the jQuery, jQuery UI, and ember.js frameworks.
- rest-app-example - [demo] - A more elaborate example of exposing web applications as HTML or JSON services that builds on the previous examples.
- json-ajax-example - A pure Javascript / Ajax application that consumes the JSON services provided by rest-app-example.
- jquery-ajax-example - Simplified version of the RESTful JSON application client from json-ajax-example using jQuery.
- hibernate-example - [demo] - Example HTML / JSON application with an HSQL database back-end using Hibernate and JPA annotations.
- hibernate-search-example - Example HTML / JSON application using Hibernate Search and Lucene for automatic fast full-text search and indexing.
- jquery-autocomplete-example - An example single-page Ajax application using JQuery UI and the JSON services provided by the hibernate-example to implement auto-complete search functionality.
- ember-example - [demo] - Example application building on jquery-autocomplete-example that uses the ember.js framework to implement a front-end RESTful MVC architecture.