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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected org.springframework.core.convert.support.GenericConversionService
Create the ConversionService instance returned by this factory bean.org.springframework.core.convert.ConversionService
Class<? extends org.springframework.core.convert.ConversionService>
boolean
void
setConverters
(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:
afterPropertiesSet
in 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
GenericConversionService
instance by default. Subclasses may override to customize the ConversionService instance that gets created. -
getObject
@Nullable public org.springframework.core.convert.ConversionService getObject()- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>
-
getObjectType
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>
-