Am developing application in spring boot.I have the two packages inside src/main/java 1. com.project.test and 2. wsdl. Inside first package I have spring boot main class. inside second package I have test.wsdl file. I try to load the test.wsdl file in main class using below code
URL wsdl = MainClass.class.getClassLoader().getResource(/wsdl/test.wsdl);
system.out.println("wsdl: "+wsdl);
It return null while run in Eclipse. When build application as jar and run application using java -jar app.jar. It return correct path. Why it return null in Eclipse. But when I run below code without prefix '/' like below. Its working fine in both Eclipse and JAR
URL wsdl = MainClass.class.getClassLoader().getResource(wsdl/test.wsdl);
system.out.println("wsdl: "+wsdl);
But my requirement is to load resource using path /wsdl/test.wsdl