public class SortedResourcesFactoryBean extends AbstractFactoryBean<Resource[]> implements ResourceLoaderAware
FactoryBean
implementation that takes a list of location Strings
and creates a sorted array of Resource
instances.Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.String> |
locations |
private ResourcePatternResolver |
resourcePatternResolver |
logger
Constructor and Description |
---|
SortedResourcesFactoryBean(java.util.List<java.lang.String> locations) |
SortedResourcesFactoryBean(ResourceLoader resourceLoader,
java.util.List<java.lang.String> locations) |
Modifier and Type | Method and Description |
---|---|
protected Resource[] |
createInstance()
Template method that subclasses must override to construct
the object returned by this factory.
|
java.lang.Class<? extends Resource[]> |
getObjectType()
This abstract method declaration mirrors the method in the FactoryBean
interface, for a consistent offering of abstract template methods.
|
void |
setResourceLoader(ResourceLoader resourceLoader)
Set the ResourceLoader that this object runs in.
|
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
private final java.util.List<java.lang.String> locations
private ResourcePatternResolver resourcePatternResolver
public SortedResourcesFactoryBean(java.util.List<java.lang.String> locations)
public SortedResourcesFactoryBean(ResourceLoader resourceLoader, java.util.List<java.lang.String> locations)
public void setResourceLoader(ResourceLoader resourceLoader)
ResourceLoaderAware
This might be a ResourcePatternResolver, which can be checked
through instanceof ResourcePatternResolver
. See also the
ResourcePatternUtils.getResourcePatternResolver
method.
Invoked after population of normal bean properties but before an init callback
like InitializingBean's afterPropertiesSet
or a custom init-method.
Invoked before ApplicationContextAware's setApplicationContext
.
setResourceLoader
in interface ResourceLoaderAware
resourceLoader
- ResourceLoader object to be used by this objectResourcePatternResolver
,
ResourcePatternUtils.getResourcePatternResolver(org.springframework.core.io.ResourceLoader)
public java.lang.Class<? extends Resource[]> getObjectType()
AbstractFactoryBean
getObjectType
in interface FactoryBean<Resource[]>
getObjectType
in class AbstractFactoryBean<Resource[]>
null
if not known at the time of the callFactoryBean.getObjectType()
protected Resource[] createInstance() throws java.lang.Exception
AbstractFactoryBean
Invoked on initialization of this FactoryBean in case of
a singleton; else, on each AbstractFactoryBean.getObject()
call.
createInstance
in class AbstractFactoryBean<Resource[]>
java.lang.Exception
- if an exception occurred during object creationAbstractFactoryBean.getObject()