2

I have the following properties inside config.properties file.

resources=/home/pc/work/resources
file1=${resources}/file1
file2=${resources}/file2
file3=${resources}/file3

And loading the java.util.Properties to read those properties:

properties = new Properties();

    InputStream inputStream = PropertyReader.class.getClassLoader().getResourceAsStream("config.properties");
    try {
        properties.load(inputStream);
    } catch (IOException e) {
        e.printStackTrace();
    }

Apparently, this will always read the values directly from the file. Is it possible to override the resources variable as a system variable while maintaining a default value?

0MLb
  • 31
  • 3
  • Please check https://stackoverflow.com/questions/35531661/using-env-variable-in-spring-boots-application-properties – Smile Dec 23 '19 at 09:18
  • 2
    Does this answer your question? [Using env variable in Spring Boot's application.properties](https://stackoverflow.com/questions/35531661/using-env-variable-in-spring-boots-application-properties) – P.J.Meisch Dec 23 '19 at 09:20

0 Answers0