ConversionServiceFactoryBean
does not registers default formatters.
You need to use FormattingConversionServiceFactoryBean
So do as below
<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
<property name="converters">
<list>
<bean class="com.my.StringToDoubleConverter" />
</list>
</property>
</bean>
if you want to use only NumberFormatAnnotationFormatterFactory
which does the Number Formatting (processes @NumberFormat
Annotation ) and disable its other default formatters then do as below
<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
<property name="registerDefaultFormatters" value="false" />
<property name="formatters">
<set>
<bean class="org.springframework.format.number.NumberFormatAnnotationFormatterFactory" />
</set>
</property>
<property name="converters">
<list>
<bean class="com.my.StringToDoubleConverter" />
</list>
</property>
</bean>
Source:Spring Docs