Spring boot could not resolve placeholder in string

Fixed by adding these lines to the pom under the <resources> section

<resource>
     <directory>src/main/resources</directory>
     <filtering>true</filtering>
     <includes>
          <include>**/*.properties</include>
     </includes>
</resource>

What I don't fully understand is the need for doing this.

a) I can run this on an external app server without having to add this line and the app reads application.properties just fine.

b) I can run the app as a standalone java application in eclipse (i.e., without having to build the app through maven) and it reads application.properties just fine

c) isn't spring-boot supposed to read it by default regardless? (as shown by the two cases above?)

Thanks everyone for their help. hopefully this will help others.


Got the same issue with IntelliJ. Invalidating caches from File -> Invalidate Caches / Restart ... fixed it for me.


Were you, by chance, running this from Eclipse?

I had the same issue and noticed that the project did not have the Maven nature. Right-clicking on the project ->Configure->Convert to Maven Project. Then right-click on the project ->Maven->Update Project solved the issue.


I too faced a similar issue when running from IntelliJ. This worked for me : Build -> Rebuild Project.