Spring by Example

Skip to main content.

Welcome

Welcome to Spring by Example. This site is for helping Spring developers collaborate by sharing Spring configuration and code examples. Any code contributed should be owned by the contributer and have the rights to release the contribution under an Open Source License.

Most Recent Examples

Topic Description
Spring Modules with Commons Configuration Spring Modules Jakarta Commons example loading properties from a database. This example will show you how to use a DatabaseConfiguration from the Jakarta Commons Configurations project to load the Database Properties into your application context.
Simple Spring Web Services A very simple example of using Spring Web Services 1.5.x with JAXB for marshalling and unmarshalling requests. A JAXB plugin for Maven is used to generate the JAXB beans from and XSD and the XSD is reused to generate a WSDL. The response from the server sends a person list, but could easily be modified to retrieve person based on an ID.
Simple GWT Spring Webapp This enhances the Spring Web Flow Subflow Webapp by using GWT (Google Web Toolkit) version 1.5-RC1 for a GWT table widget on the search page. The example also uses Spring JS to submit the person form by using Spring.remoting.submitForm to only update the content div. Dynamic Tiles Spring MVC Module? (version 1.1) has been updated to support rendering Tiles fragments like AjaxTilesView and FlowAjaxTilesView in Spring JS and Spring Web Flow.
Spring by Example JDBC The Spring by Example JDBC module has some utilities to help creating and initializing a database. There is an extension of SimpleDriverDataSource from Spring, which doesn't pool connections, that can be configured to run scripts once the class is initialized and another one based on Commons DBCP BasicDataSource. The script processor that they use can also be used separately.
One to Many JPA Hibernate Configuration One to Many JPA configuration using Hibernate that can to find, save, and update a record. There is a Person that has a one-to-many relationship to Address. This example is very similar to One to Many Hibernate Annotation Configuration example since that example was already using javax.persistence annotations to configure the Person and Address beans.

Spring In-depth, In Context

Spring In-depth, In Context is a free online book for Spring 2.5. It is a work in progress, but there is already a lot of material. It currently has a very good introduction to Spring, basic bean creation using XML and Annotations. Although the Annotations chapter isn't 100% complete. There are also partially complete chapters on Resources & ApplicationContexts and AOP.

How to Contribute

If you have a Spring example that you've worked on and feel it would be useful to share it with others, please contribute it to the site.

Create an Example

You must Register to create an example.