How to include external configuration resources to classpath in Spring (Spring Boot)?

Viewed 3411

I have 3rd party library that is configured by placing properties file on the root of the classpath. That library is using getClass().getResourceAsStream("/file.properties") to load that file. As it is 3rd party, it is unmodifiable. I have placed that configuration file into external resources directory (not to be mistaken with resources from eg. Maven's or Gradle's directory structure.

Directory structure is like this.

Dir stricture

How to run/configure Spring boot to include content of resources directory to the classpath so getResourceAsStream wil work?

On SE application I would simply do java -jar myApp.jar with classpath in MANIFEST and that would work.

EDIT:

Just a word of clarification - putting configuration file inside project resources (along sources) is missing the whole point. I want to keep configuration externalized.

1 Answers
Related