Spring Context Specific Configuration Files

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:


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: