It doesn't work because you are trying to launch the jar from another folder: spring boot looks for files/folder relative your current folder.
You can:
1) copy application.properties
either in ./
or ./config/
, relative to your current folder.
2) Or specify -Dspring.config.location
:
$ java -Dspring.config.location=target/application.properties -jar target/myproject-0.0.1-SNAPSHOT.jar