My Spring boot app (v2.1.1.RELEASE) is packaged using below plugin and layout :
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>my-service-${project.version}</finalName>
<mainClass>com.my.app.MainClass</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
I am using below launch script :
java -Dloader.path=/path/to/config/dir/ -jar my-service-1.0.jar
In one of dependencies which my app has, below code is used to read the external xml config files (e.g. hbase-site.xml) :
URL url = ClassLoader.getSystemResource(filename);
which is why I am trying to make those files available using loader.path but the app still doesn't read the files present on the provided dir. Am I missing anything else?
Already referred : Spring Boot: Is it possible to use external application.properties files in arbitrary directories with a fat jar?