title: How to modify a properties file in spring boot jar
body: <p>I am writing a Spring Boot Application.
  This application talks to  a Main Frame through MessageQueues</p>
  
  <p>So inorder to talk to that MainFrame we are provided with a java jar(which has the code that talks to MessageQueues ). lets call it proxy jar.</p>
  
  <p>We have to use the operations written from the above mentioned proxy jar .
  We dont write any code to read/write to MessageQueues (IBM MessageQueues) in our application, this is done by the proxy jar and its dependent runtime jar.</p>
  
  <p>So here comes the problem, this Proxy jar is coded in such a way that it looks for a file called 'commcfg.properties' in the classpath (expects the name to be exactly same). Actually the Proxy jar uses another dependent jar (lets call runtime jar)which reads the queue details from commcfg.properties and reads/writes from Message Queues.</p>
  
  <p>commcfg.properties have the values of MessageQueue and Host and port of those Queues . In short Queue details.</p>
  
  <p>So the trouble is these MessageQueue details will be different in different environments. I need to use the commcfg.properties according to environment</p>
  
  <p>So far my trials to solve this.</p>
  
  <ol>
  <li><p>Lets say I have two environments .
  So I will have two different set of values of commcfg.properties</p>
  
  <p>I have created files as follows
  commcfg.DEV.properties
  commcfg.PROD.properties so that they will be in classpath</p>
  
  <p>Next I have written code such that it will pick up the particular property 
  file depending on Environment and rename it to commcfg.properties(as the 
  Proxy jar and its helper dependent Runtime jar need the exact name to be 
  commcfg.properties).</p>
  
  <p>In my local workspace I could do this .
  But when deployed (we use docker) that gets packaged into spring boot jar.</p>
  
  <p>So my hack is not working as we cannot rename files with in jars.</p></li>
  <li><p>Another thought I had:</p>
  
  <p>Before I call my functionality code , I will put  the commcfg.properties in 
  class path (project/src/main/resources) 
  I will read it and modify the values as needed per environment.
  The values I will have them in application.properties.
  But again I doubt that with in jar I cannot modify the file.</p></li>
  </ol>
  
  <p>Hoping I am clear 
  Kindly help me out..</p>