Spring can be configured in lots of different ways and using context specific XML configuration is one of the preferred approaches. Context specific configuration in other words is simply a chunk of XML specific to a single concern (e.g. servlet config, jpa config, and whatever else you need). A classic example of this is the servlet-config.xml that the Dispatcher Servlet binds against:

{% highlight xml %} fitTrackerServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/config/servlet-config.xml {% endhighlight %} Other Context specific configuration files can be registered by hacking your web.xml. Here’s an example for defining a place to stick JPA related cruft:

{% highlight xml %} contextConfigLocation classpath:/jpaContext.xml

org.springframework.web.context.ContextLoaderListener {% endhighlight %}