Showing posts with label Spring. Show all posts
Showing posts with label Spring. Show all posts

Thursday, August 8, 2013

How to dynamically load file properties based on environments: Spring Profiles tutorial

If you are working with different environments which need different property file configurations, maybe the best way is to load a specific profile for each different environment wich load the specific properties for that environment. There are different ways to create profiles in Java, but in this post I will just talk about the way I used.
My applications normally uses Spring framework and Maven for the build/deploy process. In Maven 3 is possible to create profiles but I find it not very usefull because if you want to create application properties dynamically then you need to use ant plugins, so I found another way: using Spring Profiles (avaliable from Spring 3.1).