0

In the actual production and development servers, the base path is set with the code below.

private static String FILE_DIR = System.getProperty("user.dir") + File.separator + "FILES"; 

I want to move this code to application.properties.

Is there a way to use a path like System.getProperty in application.properties?

Sorry for such a novice question

1 Answer 1

1

I tried the following in application.yml and it worked.

filedir: ${user.dir}${file.separator}FILES 

And then

@Value("${filedir}") private String fileDir; 

Please let me know it it wrks for you.

Sign up to request clarification or add additional context in comments.

2 Comments

${user.dir} worked very successfully. Unfortunately ${file.separator=='\\' ?/:\\} didn't work, but ${file.separator} worked instead. Thanks for your help.
I voted up your answer. But edit it please. Note that ${file.separator} is enough.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.