3.0에 새로 추가된  <mvc:annotation-driven>을 등록할 때 자동으로 등록되는 FormattingConversionServiceFactoryBean이 있을 때 기본으로 사용할 수 있는 Converter와 Formatter를 살펴보겠습니다.

사실 이 클래스는 프로젝트에서 확장할 가능성이 높은 클래스입니다. 사용하는 도메인에 대한 포매터를 제공할 가능성이 높기 떄문이죠. 그렇지 않고 그냥 쓴다는 건... 글쎄요. 스프링의 바인딩 기능을 제대로 활용하지 않고 있는 프로젝트일 가능성이 높습니다. 3.0 이전이었다면 모든 요청에 걸쳐 전역적으로 바인딩에 활용할 녀석을 PropertyEditorRegistrar(PER)를 구현한 클래스를 만들어  ConfigurableWebBindingInitializer에 빈으로 끼워넣었습니다.

그래서인지 <mvc:annotation-driven> 에도 conversion-service 속성을 제공하여 자신이 확장한 FCSFB를 끼워넣을 수 있게 해줍니다.

그런데.. 그냥 기본으로 사용할 때 대체 어떤 것들이 들어있는지는 API에도 명확히 나와있지 않습니다.

A factory for a FormattingConversionService that installs default formatters for common types such as numbers and datetimes.

Subclasses may override installFormatters(FormatterRegistry) to register custom formatters.

숫자나 날짜 같은 흔히 사용하는 타입에 대한 기본 포매터를 설치해준다. 확장할 땐 머시기 메서드를 써라.

흠.. 뭐가 있는지 알아야 쓰지 말입니다. @_@; 그래서 FCSFB 객체를 콘솔에 출력해봤습니다.

ConversionService converters =
    @org.springframework.format.annotation.DateTimeFormat java.lang.Long -> java.lang.String: org.springframework.format.support.FormattingConversionServiceFactoryBean$NoJodaDateTimeFormatAnnotationFormatterFactory@794e113b, @org.springframework.format.annotation.NumberFormat java.lang.Long -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    @org.springframework.format.annotation.DateTimeFormat java.util.Calendar -> java.lang.String: org.springframework.format.support.FormattingConversionServiceFactoryBean$NoJodaDateTimeFormatAnnotationFormatterFactory@794e113b
    @org.springframework.format.annotation.DateTimeFormat java.util.Date -> java.lang.String: org.springframework.format.support.FormattingConversionServiceFactoryBean$NoJodaDateTimeFormatAnnotationFormatterFactory@794e113b
    @org.springframework.format.annotation.NumberFormat java.lang.Double -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    @org.springframework.format.annotation.NumberFormat java.lang.Float -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    @org.springframework.format.annotation.NumberFormat java.lang.Integer -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    @org.springframework.format.annotation.NumberFormat java.lang.Short -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    @org.springframework.format.annotation.NumberFormat java.math.BigDecimal -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    @org.springframework.format.annotation.NumberFormat java.math.BigInteger -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    java.lang.Character -> java.lang.Number : org.springframework.core.convert.support.CharacterToNumberFactory@69236cd5
    java.lang.Number -> java.lang.Character : org.springframework.core.convert.support.NumberToCharacterConverter@552c8fa8
    java.lang.Number -> java.lang.Number : org.springframework.core.convert.support.NumberToNumberConverterFactory@1cee1ede
    java.lang.String -> @org.springframework.format.annotation.DateTimeFormat java.lang.Long: org.springframework.format.support.FormattingConversionServiceFactoryBean$NoJodaDateTimeFormatAnnotationFormatterFactory@794e113b, java.lang.String -> @org.springframework.format.annotation.NumberFormat java.lang.Long: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    java.lang.String -> @org.springframework.format.annotation.DateTimeFormat java.util.Calendar: org.springframework.format.support.FormattingConversionServiceFactoryBean$NoJodaDateTimeFormatAnnotationFormatterFactory@794e113b
    java.lang.String -> @org.springframework.format.annotation.DateTimeFormat java.util.Date: org.springframework.format.support.FormattingConversionServiceFactoryBean$NoJodaDateTimeFormatAnnotationFormatterFactory@794e113b
    java.lang.String -> @org.springframework.format.annotation.NumberFormat java.lang.Double: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    java.lang.String -> @org.springframework.format.annotation.NumberFormat java.lang.Float: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    java.lang.String -> @org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    java.lang.String -> @org.springframework.format.annotation.NumberFormat java.lang.Short: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    java.lang.String -> @org.springframework.format.annotation.NumberFormat java.math.BigDecimal: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    java.lang.String -> @org.springframework.format.annotation.NumberFormat java.math.BigInteger: org.springframework.format.number.NumberFormatAnnotationFormatterFactory@47ad6b4b
    java.lang.String -> java.lang.Boolean : org.springframework.core.convert.support.StringToBooleanConverter@4dbb9a58
    java.lang.String -> java.lang.Character : org.springframework.core.convert.support.StringToCharacterConverter@57922f46
    java.lang.String -> java.lang.Enum : org.springframework.core.convert.support.StringToEnumConverterFactory@67dacccc
    java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory@3fe2670b
    java.lang.String -> java.util.Locale : org.springframework.core.convert.support.StringToLocaleConverter@28db23f1
    java.lang.String -> java.util.Properties : org.springframework.core.convert.support.PropertiesToStringConverter@14be49e0
    org.springframework.core.convert.support.ArrayToArrayConverter@53f78b68
    org.springframework.core.convert.support.ArrayToCollectionConverter@9ac5f13
    org.springframework.core.convert.support.ArrayToObjectConverter@744d76b4
    org.springframework.core.convert.support.ArrayToStringConverter@1395dd5b
    org.springframework.core.convert.support.CollectionToArrayConverter@5e6214f5
    org.springframework.core.convert.support.CollectionToCollectionConverter@2eb0a3f5
    org.springframework.core.convert.support.CollectionToObjectConverter@4a5f2db0
    org.springframework.core.convert.support.CollectionToStringConverter@4edc41c5
    org.springframework.core.convert.support.IdToEntityConverter@20e183e9, org.springframework.core.convert.support.ObjectToObjectConverter@359b46dc
    org.springframework.core.convert.support.MapToMapConverter@4b14b82b
    org.springframework.core.convert.support.ObjectToArrayConverter@14004204
    org.springframework.core.convert.support.ObjectToCollectionConverter@65493102
    org.springframework.core.convert.support.ObjectToStringConverter@2830ae41
    org.springframework.core.convert.support.StringToArrayConverter@3e5dc994
    org.springframework.core.convert.support.StringToCollectionConverter@58e41bc3

흠.. 저런 것들이 있군요.