ClassPathResource cannot load truststore


I'm using a configuration that's alleged to be working when running from Eclipse but when ClassPathResource from spring is loading classpath:truststore.jks and even though at the root of my target's classes folder has truststore.jks the call 

So this is when running the embedded spring boot Tomcat from inside the IDE Intellij Idea 2019.1.1

ClassPathResource cpr = new ClassPathResource("classpath:truststore.jks")

cpr.exists() returns false


Comment actions Permalink

Is it possible to share a small project to reproduce the issue so that we can check the configuration? You can upload it here: .

Comment actions Permalink

Please close for now. Code I was using expects to find the resource using the ClassPathResource but I can only get it working using ResourceUtils.getURL(location)

I don't think it's expected that ClassPathResource be able to understand classpath: prefixes.


Please sign in to leave a comment.