1

I have file src/main/resources/dev/important.properties where in fact 'dev' is one of Spring profile names I use. Somewhere in application this file is referenced as:

@PropertySource(value = "classpath:important.properties")

When I run in Intellij:

mvn spring-boot:run -Dspring-boot.run.profiles=dev

I get FileNotFoundException upon application start. If I move file one level up (to src/main/resources) it works. I can say no surprise here. How to add src/main/resources/dev to classpath so this file would be visible in this directory? This stuff is needed only for local development (Maven+Intellij and dev profile) and it's excluded from runnable jar. I do not want to modify @PropertySource expression.

user3848246
  • 127
  • 1
  • 5
  • This will fix your problem: https://stackoverflow.com/a/9063515/13211030. However it does require your `@PropertySource` to be changed (also not sure why it's so important to keep this the way it is). – Fullslack Jul 20 '20 at 14:27

0 Answers0