There are several times when you need to specify a location in a Springframework configuration. An example is
<util:properties id="gsiProperties" location="classpath:gaming-adapter-default.properties"/>
A location is represented as a Resource. There are several ways to specify where to find the resource.
- classpath: This represents a resource that should be retrieved from the classpath. It works the way a normal classloader does. The first match wins. Package names can also be represented as file directories (e.g. /this/that/my.properties
- classpath:* This means that ALL resources that match the given name must be obtained, then merged to form a single resource. Meaning multiple property files could be mapped to. The sum of them would be used to supply the properties.
- file: This is used to access a file system resource. This can be an absolute path or relative path.
- http: This is used to access resources via HTTP protocol with a URL.
- ftp: this is used to access a resource via FTP protocol.
- blank This relies upon the implementation of the underlying context. For web applications, this utilizes the Servlet context.
sheltonn July 28th, 2015
Posted In: java ninja, Javaninja, Spring
classpath, ftp, http, properties, Spring, SpringFramework