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.logger
OBJECT_TYPE_ATTRIBUTE
Constructor and Description |
---|
SortedResourcesFactoryBean(List<String> locations) |
SortedResourcesFactoryBean(ResourceLoader resourceLoader,
List<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.
|
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
public SortedResourcesFactoryBean(ResourceLoader resourceLoader, List<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
- the ResourceLoader object to be used by this objectResourcePatternResolver
,
ResourcePatternUtils.getResourcePatternResolver(org.springframework.core.io.ResourceLoader)
public 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 Exception
AbstractFactoryBean
Invoked on initialization of this FactoryBean in case of
a singleton; else, on each AbstractFactoryBean.getObject()
call.
createInstance
in class AbstractFactoryBean<Resource[]>
Exception
- if an exception occurred during object creationAbstractFactoryBean.getObject()