February 20, 2008
DWR and Spring is a great combination. The Spring integration in DWR can support many configurations but many times this can lead to confusion. The goal of this article is to provide developers with a working skeleton for several common environments (using Spring MVC, not using Spring MVC, using the DWR Namespace, etc.).
Before we get started you may want to take a quick look at the official DWR documentation.
The DWR Namespace Handler:
Spring 2.x introduced an “XML Namespace Handlers” feature. DWR 2.x allows you to leverage this feature through a custom namespace — eliminating the need for the DWR configuration file (dwr.xml). If you are using DWR > 2.0.x and Spring > 2.x this is the recommended approach if you want seamless integration (almost) between DWR and Spring.
There are a myriad of configurations to consider. I have included what I feel or the more popular choices. Please select a link for a detailed description of each configuration and to download a fully functioning basic example:
- I am using DWR 3.x, and Spring 3.x …
- I am using DWR 3.x and Spring 3.x and I would like to use Annotations without Spring MVC.
- I am using DWR 3.x and Spring 3.x and I would like to use Annotations with Spring MVC.
- I am using DWR 2.0.x, Spring 2.x, and Spring MVC
- I am using DWR 2.0.x, Spring 2.x, but I am not using Spring MVC
If you are using an older version (pre 2.x) of DWR or Spring, DWR still provides integration with Spring through the Spring Creator. This configuration requires a dwr.xml configuration. Information on this set-up is covered in the DWR manual.