0

I have a legacy application on which I am working to implement some requirements. While doing so, I want to load the environment specific properties file for each environment. For example:

<context:property-placeholder location="classpath:myResource/data.properties" />

I want to load this data.properties file based on the environment like local,dev,qa. I know we have profile configuration after Spring 3.0 but we do not have any plan soon to upgrade the current version. Is there a way I could accomplish this the way we can do by activating the profile?

I tried the below approach but did not work:where I passed jvm arguments as -Dprofile=dev

<context:property-placeholder ignore-resource-not-found="true" location="classpath:myResource/data-${profile}.properties/>
user123475
  • 1,065
  • 4
  • 17
  • 29
  • 2.5 really? (that's [almost 10y old](https://spring.io/blog/2007/11/19/spring-framework-2-5-released)..) –  Mar 29 '17 at 20:34
  • yes it is. I had same feeling when I joined few weeks back. They started this project 10 years back and kept on adding the things instead of upgrading spring. I am noone to decide their tech stack so far – user123475 Mar 29 '17 at 20:35
  • Based on my experience, spring is pretty well "managed", so I will go with the upgrade to 4.x, you probably will be done in a day without too much harm –  Mar 29 '17 at 20:38
  • I got your point. But, they are not letting me upgrade it as its really huge system and they say they dont want to take a risk at this time – user123475 Mar 29 '17 at 20:41
  • Take this as a personal opinion, and I'm sorry if anyone choke on this comment, but you should just get the hell out, there is no way some a##h#le should dict you to add some **new feature** to some 10y old system and then tell you they "dont want to take a risk at this time" –  Mar 29 '17 at 20:47

0 Answers0