Is it possible to use relative path in spring.config.location
?
I have the following structure in IntelliJ
|-dev.yml
|-src
|-main
|-java
|-com.foo
|-MySpringApp.java
and run it with
--spring.config.location=dev.yml
which doesn't work
The only thing that works is setting full path
--spring.config.location=/user/.../myApp/dev.yml
Strange no-one ever answered this.
I just worked it out myself by trial and error.
A relative path is always going to work because Java is running from some directory wherever and whenever you run it. Just a case of discovering what it is.
In my case with Win10, Java 1.8, IntelliJ 2018 and Spring Boot 2.0.2, running my app as a Spring Boot app in IntelliJ, my relative path is relative to the project root.
So for you, I would assume that it starts out the same way, using the project root. Since that is where your properties are, you need .
, and then since it is a directory, you need to append a slash on the end:
--spring.config.location=./
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With