Class ConversionServiceFactoryBean
java.lang.Object
org.springframework.context.support.ConversionServiceFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>,org.springframework.beans.factory.InitializingBean
public class ConversionServiceFactoryBean
extends Object
implements org.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>, org.springframework.beans.factory.InitializingBean
A factory providing convenient access to a ConversionService configured with
converters appropriate for most environments. Set the
"converters" property to supplement the default converters.
This implementation creates a DefaultConversionService.
Subclasses may override createConversionService() in order to return
a GenericConversionService instance of their choosing.
Like all FactoryBean implementations, this class is suitable for
use when configuring a Spring application context using Spring <beans>
XML. When configuring the container with
@Configuration
classes, simply instantiate, configure and return the appropriate
ConversionService object from a @Bean method.
- Since:
- 3.0
- Author:
- Keith Donald, Juergen Hoeller, Chris Beams
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected org.springframework.core.convert.support.GenericConversionServiceCreate the ConversionService instance returned by this factory bean.org.springframework.core.convert.ConversionServiceClass<? extends org.springframework.core.convert.ConversionService>booleanvoidsetConverters(Set<?> converters) Configure the set of custom converter objects that should be added: implementingConverter,ConverterFactory, orGenericConverter.
-
Constructor Details
-
ConversionServiceFactoryBean
public ConversionServiceFactoryBean()
-
-
Method Details
-
setConverters
Configure the set of custom converter objects that should be added: implementingConverter,ConverterFactory, orGenericConverter. -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
createConversionService
protected org.springframework.core.convert.support.GenericConversionService createConversionService()Create the ConversionService instance returned by this factory bean.Creates a simple
GenericConversionServiceinstance by default. Subclasses may override to customize the ConversionService instance that gets created. -
getObject
@Nullable public org.springframework.core.convert.ConversionService getObject()- Specified by:
getObjectin interfaceorg.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingletonin interfaceorg.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>
-