last day (16 days later) » 

6:15 PM
0
A: how to package the springboot application with dynamic end points on application.properties file

bittuYes absolutely possible. Basically what you need is changing the property value as needed without changing jar/war Passing command line args for jar Package your spring boot application as jar and put the external application.properties file at any location and pass on the same location as com...

 
Thanks bittu for quick reply. We need to deploy this on tomcat server. So i think we can deploy only war not jar on tomcat server.
 
Ah Right. SpringBootApplicationBuilder.addCommandLineProperties will allow you to do that. Configuring env variable(config path or any property) and reading the same at run time then setting the same via above mentioned method should be helpful.
 
Thanks bittu. Can you please help me with an example?
 
Updated the answer. Its working for me.
 
Thanks bittu. I updated my question. Please read again. My springboot application have 2 modules : 1) elasticpath module which is having elasticpath-application.properties 2) salesforce - salesforce-application.properties Now i have to externalize "C:\apache-tomcat-8.5.29\conf\ep-external.properties" file which will override the existing property. Now problem is that @PropertySource is loading in last position. So my external file is not able to override the property.
 
6:15 PM
elasticpath-application.properties should be replaced by external ep-external.properties. Is this what you want ?
hi
if the above said question answer is Yes the I would say why we are keeping the external file different then actual one which is being referred from your applicaition. Can we the file name same like elasticpath-applicatoin.properties and use the properties("spring.config.location:${config:null}") to pass the path of external file.
Attention to be given here is ${config} should be path to the directory(lie c:/test/config/) where property file is being kept. Not the absolute file path.
if file names can't be same then another option is to manually load file which is available at external path and override the properties manually by method SpringApplicationBuilder.properties(Properties) in overridden configure method.
From any property file you can Properties object and use the same
*create
Hope this helps
 

  last day (16 days later) »