Recently I have been exploring the Spring MVC Framework using on Spring 3.1. Based on my Grails experience I was surprised by the amount of manual configuration that is required. Nevertheless, I thought I would quickly share how to configure development and production environments in your application. Spring 3.1 introduced what is known as Profiles, which allow the developer to create various bean definitions to be used in different environments.
For instance, in order to use a different database for your dev and prod environments you could configure your sevlet-context.xml file with the following:
Then in your web.xml file you would have the following if you were deploying for the dev environment:
It’s just that simple…