Package org.springframework.context.support

# 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
Constructor
Description
`ConversionServiceFactoryBean()`

## Method Summary

Modifier and Type
Method
Description
`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()`
`Class<? extends org.springframework.core.convert.ConversionService>`
`getObjectType()`
`boolean`
`isSingleton()`
`void`
`setConverters(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 Details

### ConversionServiceFactoryBean

public ConversionServiceFactoryBean()

## Method Details

### setConverters

public void setConverters(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

@Nullable public org.springframework.core.convert.ConversionService getObject()

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

### getObjectType

public 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>`