I am trying to store application.properties file outside of the jar. i don't want it in the resources folder, so i have decided to use the below code snippet
@Configuration
@PropertySource(value = "file:/home/myname/configs/application.properties")
public class ExternalFilePropertiesConfiguration {
}
This is working so perfect. The issue here is it becomes a problem when i want to deploy on another machine where there is no folder with myname name in it.
I tried to let the code read the folder structure first and create a path using the code below
String path =System.getProperty("user.home") + File.separator+"configs"+File.separator+"application.properties";
But i am failing to pass the variable back to the path.
May you please help me with a way to replace the string "file:/home/myname/configs/application.properties" with the variable path.