We have a properties file, kafka.properties located under src/main/resources and the following two snippets of code.
1:
ClassLoader.getSystemClassLoader().getResourceAsStream("kafka.properties");
2: this.getClass().getClassLoader().getResourceAsStream("kafka.properties");
Both of these code snippets work fine on my local machine. However, whenever we deploy our application onto our cloud server only the second code snippet works.
I'm assuming it's something to do with the fact that on our server we are running a zipped .jar file, whereas when I run it locally IntelliJ compiles it in memory and uses the filesystem for lookup.
I'm curious what causes this and what the specific differences are between these two methods?