Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring include relative path in properties

I'm trying to make it so that in config/app.properties, I can have:

myfile.location=./myfile

where . is relative to said properties file. Is this possible ? I tried:

resourceLoader.getResource(appConfig.getMyFileLocation());

where resourceLoader and appConfig are autowired, but it won't work.

like image 533
Vinz243 Avatar asked Mar 16 '26 02:03

Vinz243


1 Answers

I usually reference my files like this:

myfile.location=classpath:myfile

where myfile is at the same location as the properties file.

like image 187
StrongPoint Avatar answered Mar 17 '26 15:03

StrongPoint