PropertiesPropertySource that loads a Properties object
from a given org.springframework.core.io.Resource or resource location such as
"classpath:/com/myco/foo.properties" or "file:/path/to/file.xml".
Both traditional and XML-based properties file formats are supported; however, in
order for XML processing to take effect, the underlying Resource's
getFilename() method must
return a non-null value that ends in ".xml".
org.springframework.core.io.Resource , org.springframework.core.io.support.EncodedResource
| Modifier and Type | Field and Description |
|---|---|
| private final String | resourceName
The original resource name, if different from the given name. |
| Access | Constructor and Description |
|---|---|
| public | ResourcePropertySource(String name, EncodedResource resource)
Create a PropertySource having the given name based on Properties loaded from the given encoded resource. |
| public | ResourcePropertySource(EncodedResource resource)
Create a PropertySource based on Properties loaded from the given resource. |
| public | ResourcePropertySource(String name, Resource resource)
Create a PropertySource having the given name based on Properties loaded from the given encoded resource. |
| public | ResourcePropertySource(Resource resource)
Create a PropertySource based on Properties loaded from the given resource. |
| public | ResourcePropertySource(String name, String location, ClassLoader classLoader)
Create a PropertySource having the given name based on Properties loaded from
the given resource location and using the given class loader to load the
resource (assuming it is prefixed with |
| public | ResourcePropertySource(String location, ClassLoader classLoader)
Create a PropertySource based on Properties loaded from the given resource
location and use the given class loader to load the resource, assuming it is
prefixed with |
| public | ResourcePropertySource(String name, String location)
Create a PropertySource having the given name based on Properties loaded from the given resource location. |
| public | ResourcePropertySource(String location)
Create a PropertySource based on Properties loaded from the given resource location. |
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static String | getNameForResource(Resource resource)
Return the description for the given Resource; if the description is empty, return the class name of the resource plus its identity hash code. |
| public ResourcePropertySource | withName(String name)
Return a potentially adapted variant of this |
| public ResourcePropertySource | withResourceName()
Return a potentially adapted variant of this |
| resourceName | back to summary |
|---|---|
| private final String resourceName The original resource name, if different from the given name. | |
| ResourcePropertySource | back to summary |
|---|---|
| public ResourcePropertySource(String name, EncodedResource resource) throws IOException Create a PropertySource having the given name based on Properties loaded from the given encoded resource. | |
| ResourcePropertySource | back to summary |
|---|---|
| public ResourcePropertySource(EncodedResource resource) throws IOException Create a PropertySource based on Properties loaded from the given resource.
The name of the PropertySource will be generated based on the
| |
| ResourcePropertySource | back to summary |
|---|---|
| public ResourcePropertySource(String name, Resource resource) throws IOException Create a PropertySource having the given name based on Properties loaded from the given encoded resource. | |
| ResourcePropertySource | back to summary |
|---|---|
| public ResourcePropertySource(Resource resource) throws IOException Create a PropertySource based on Properties loaded from the given resource.
The name of the PropertySource will be generated based on the
| |
| ResourcePropertySource | back to summary |
|---|---|
| public ResourcePropertySource(String name, String location, ClassLoader classLoader) throws IOException Create a PropertySource having the given name based on Properties loaded from
the given resource location and using the given class loader to load the
resource (assuming it is prefixed with | |
| ResourcePropertySource | back to summary |
|---|---|
| public ResourcePropertySource(String location, ClassLoader classLoader) throws IOException Create a PropertySource based on Properties loaded from the given resource
location and use the given class loader to load the resource, assuming it is
prefixed with | |
| ResourcePropertySource | back to summary |
|---|---|
| public ResourcePropertySource(String name, String location) throws IOException Create a PropertySource having the given name based on Properties loaded from
the given resource location. The default thread context class loader will be
used to load the resource (assuming the location string is prefixed with
| |
| ResourcePropertySource | back to summary |
|---|---|
| public ResourcePropertySource(String location) throws IOException Create a PropertySource based on Properties loaded from the given resource
location. The name of the PropertySource will be generated based on the
| |
| ResourcePropertySource | back to summary |
|---|---|
| private ResourcePropertySource(String name, String resourceName, Map<String, Object> source) | |
| getNameForResource | back to summary |
|---|---|
| private static String getNameForResource(Resource resource) Return the description for the given Resource; if the description is empty, return the class name of the resource plus its identity hash code. | |
| withName | back to summary |
|---|---|
| public ResourcePropertySource withName(String name) Return a potentially adapted variant of this
| |
| withResourceName | back to summary |
|---|---|
| public ResourcePropertySource withResourceName() Return a potentially adapted variant of this
| |