Arun Thangavel
Arun Thangavel

Reputation: 33

Spring Boot/Intellij Resource not loading from src/main/resources folder

Spring Boot - 1.4.1; IDE - IntelliJ 2016.3.EAP

I am trying to load resource like below;

f = new File("src/main/resources/PROD_SiteMinder.properties");

and

System.setProperty("javax.net.ssl.trustStore","src/main/resources/BETA_StagingNewCert.jks");

Both these are working fine when I run the app from IDE, but its not working when I try to build the app as war and deploy it on Tomcat.

Could someone please help me out how to resolve this issue?

Thanks

Upvotes: 1

Views: 1776

Answers (1)

Jamie Bisotti
Jamie Bisotti

Reputation: 2675

I don't think you want to load "src/..." from production code. The source won't be available at runtime. Typically, one would load from the classpath (anything in src/main/resources will be copied and available at the root of the classpath -- new File("PROD_SiteMinder.properties")

That said, if you are using Spring, prefer ClassPathResource over new File(...).

Good luck.

Upvotes: 2

Related Questions