Spring boot properties: path to local project

Viewed 25

application.properties path.repository=/repository

When I execute the jar file from the project folder, the path defined in the application.properties works fine and it founds the folder. But if I execute it from any other folder, the path is relative to this folder.

For example, path is spring/project/repository

  • From project folder -> java -jar target/SNAPSHOT.jar -> Repository path is spring/project/repository
  • From spring folder -> java -jar project/target/SNAPSHOT.jar -> Repository path is spring/repository

I have tried classpath:/repository, but it only finds the file if it is in the src/main/resources

0 Answers
Related