> For the complete documentation index, see [llms.txt](https://wannaqueen.gitbook.io/spring5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wannaqueen.gitbook.io/spring5/spring-5.0/3.-by-ys-sh/3.4-by-sh/3.4.5-by-sh.md).

# 3.4.5 ConversionService 구성

**`ConversionService`는 응용 프로그램 구동 시에 인스턴스 화 된 다음에 여러 스레드 간에 공유되도록 설계된 무 상태의 객체입니다. 스프링 어플리케이션에서는 일반적으로 각 스프링 컨테이너(또는 `ApplicationContext`)에 대해 `ConversionService`인스턴스를 구성합니다. 스프링은 해당 `ConversionService`를 선택하고 프레임 워크에서 타입 변환을 수행할 때마다 이것을 사용합니다. 이 `ConversionService`를 임의의 빈에 주입하여 직접 호출할 수도 있습니다.**&#x20;

| `ConversionService`가 스프링에 등록되어 있지 않으면, 원래의 `PropertyEditor`기반의 시스템이 사용됩니다. |
| -------------------------------------------------------------------------- |

**기본 `ConversionService`를 스프링에 등록하려면, 다음 빈 정의를 `ConversionService`의 `id`와 함께 추가하십시오.**&#x20;

```markup
<bean id="conversionService"
    class="org.springframework.context.support.ConversionServiceFactoryBean"/>
```

**기본 `ConversionService`는 문자열, 숫자, 열거 형, 컬렉션, Map 및 기타 일반 타입 간에 변환할 수 있습니다. 사용자 지정 Converter를 사용하여 기본 Converter를 보완하거나 무시하려면 `converters`속성을 설정하십시오.** 속성 값은 `Converter`, `ConverterFactory`또는 `GenericConverter`인터페이스 중 하나를 구현할 수 있습니다.&#x20;

```markup
<bean id="conversionService"
        class="org.springframework.context.support.ConversionServiceFactoryBean">
    <property name="converters">
        <set>
            <bean class="example.MyCustomConverter"/>
        </set>
    </property>
</bean>
```

{% hint style="info" %}
**Spring 3에서는 타입 변환을 위해 Run-time 시에 사용되는 ConversionService 빈을 'conversionService'라는 이름으로 찾는다.** 따라서 다른 용도의 빈을 'conversionService'라는 이름으로 등록해서는 안된다.
{% endhint %}

또한 스프링 MVC 어플리케이션 내에서 `ConversionService`를 사용하는 것이 일반적입니다. 스프링 MVC 장의 [Conversion and Formatting](https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#mvc-config-conversion) 을 보십시오.

경우에 따라, 변환 중에 서식을 적용할 수도 있습니다. using`FormattingConversionServiceFactoryBean`사용에 대한 자세한 내용은 [`FormatterRegistry`](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#format-FormatterRegistry-SPI)SPI를 참조하십시오.&#x20;
