You need to use a url for org.springframework.core.io.UrlResource.Check the javadoc of the org.springframework.core.io.UrlResource
Resource implementation for java.net.URL locators. Obviously supports resolution as URL, and also as File in case of the "file:" protocol.
You need to use the org.springframework.core.io.ClassPathResource
Resource implementation for class path resources. Uses either a given ClassLoader or a given Class for loading resources.
Supports resolution as java.io.File if the class path resource resides in the file system, but not for resources in a JAR. Always supports resolution as URL.
Cheers!
Duminda Ekanayake