Specifying relative path in application.properties in Spring

Somasundaram Sekar picture Somasundaram Sekar · Apr 29, 2016 · Viewed 29.4k times · Source

Is there a way we can lookup file resources using relative path in application.properties file in Spring boot application as specified below

spring.datasource.url=jdbc:hsqldb:file:${project.basedir}/db/init

Answer

chendu picture chendu · May 10, 2017

I'm using spring boot to build a upload sample, and meet the same problem, I only want to get the project root path. (e.g. /sring-boot-upload)

I find out that below code works:

upload.dir.location=${user.dir}\\uploadFolder