Package org.springframework.jdbc.config
Class SortedResourcesFactoryBean
- java.lang.Object
- org.springframework.beans.factory.config.AbstractFactoryBean<Resource[]>
- org.springframework.jdbc.config.SortedResourcesFactoryBean
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,DisposableBean
,FactoryBean<Resource[]>
,InitializingBean
,ResourceLoaderAware
public class SortedResourcesFactoryBean extends AbstractFactoryBean<Resource[]> implements ResourceLoaderAware
FactoryBean
implementation that takes a list of location Strings and creates a sorted array ofResource
instances.- Since:
- 3.0
- Author:
- Dave Syer, Juergen Hoeller, Christian Dupuis
Field Summary
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Constructor Summary
Constructors Constructor Description SortedResourcesFactoryBean(List<String> locations)
SortedResourcesFactoryBean(ResourceLoader resourceLoader, List<String> locations)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
Constructor Detail
SortedResourcesFactoryBean
public SortedResourcesFactoryBean(List<String> locations)
SortedResourcesFactoryBean
public SortedResourcesFactoryBean(ResourceLoader resourceLoader, List<String> locations)
Method Detail
setResourceLoader
public void setResourceLoader(ResourceLoader resourceLoader)
Description copied from interface:ResourceLoaderAware
Set the ResourceLoader that this object runs in.This might be a ResourcePatternResolver, which can be checked through
instanceof ResourcePatternResolver
. See also theResourcePatternUtils.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'ssetApplicationContext
.- Specified by:
setResourceLoader
in interfaceResourceLoaderAware
- Parameters:
resourceLoader
- the ResourceLoader object to be used by this object- See Also:
ResourcePatternResolver
,ResourcePatternUtils.getResourcePatternResolver(org.springframework.core.io.ResourceLoader)
getObjectType
public Class<? extends Resource[]> getObjectType()
Description copied from class:AbstractFactoryBean
This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.- Specified by:
getObjectType
in interfaceFactoryBean<Resource[]>
- Specified by:
getObjectType
in classAbstractFactoryBean<Resource[]>
- Returns:
- the type of object that this FactoryBean creates, or
null
if not known at the time of the call - See Also:
FactoryBean.getObjectType()
createInstance
protected Resource[] createInstance() throws Exception
Description copied from class:AbstractFactoryBean
Template method that subclasses must override to construct the object returned by this factory.Invoked on initialization of this FactoryBean in case of a singleton; else, on each
AbstractFactoryBean.getObject()
call.- Specified by:
createInstance
in classAbstractFactoryBean<Resource[]>
- Returns:
- the object returned by this factory
- Throws:
Exception
- if an exception occurred during object creation- See Also:
AbstractFactoryBean.getObject()