spring-context

org.springframework.context.support
Class ConversionServiceFactoryBean

java.lang.Object
  extended by 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 java.lang.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

Constructor Summary
ConversionServiceFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  org.springframework.core.convert.support.GenericConversionService createConversionService()
          Create the ConversionService instance returned by this factory bean.
 org.springframework.core.convert.ConversionService getObject()
           
 java.lang.Class<? extends org.springframework.core.convert.ConversionService> getObjectType()
           
 boolean isSingleton()
           
 void setConverters(java.util.Set<?> converters)
          Configure the set of custom converter objects that should be added: implementing Converter, ConverterFactory, or GenericConverter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionServiceFactoryBean

public ConversionServiceFactoryBean()
Method Detail

setConverters

public void setConverters(java.util.Set<?> converters)
Configure the set of custom converter objects that should be added: implementing Converter, ConverterFactory, or GenericConverter.


afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.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

public org.springframework.core.convert.ConversionService getObject()
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>

getObjectType

public java.lang.Class<? extends org.springframework.core.convert.ConversionService> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<org.springframework.core.convert.ConversionService>

spring-context