I have a Spring Boot application, the code need to access a file under resources folder. here is my application.properties file:
cert.file=classpath:/resources/cert.p12
however it always complained:
java.io.FileNotFoundException: classpath:/resources/cert.p12 (No such file or directory)
I double checked folder my_project/target/classes to make sure the file cert.p12 exits there.
and in the code I tried to access the file:
@Value("${cert.file}")
private String certFile;
....
@Bean
public Sender sender() {
return new Sender(certFile);
}
what exactly is the this classpath? and why it cannot find the file? Thanks!