我最近使用类似的东西来解决这个问题。使用自定义工厂:
public class MyConversionServiceFactoryBean extends ConversionServiceFactoryBean { @Override public void afterPropertiesSet() { super.afterPropertiesSet(); ConversionService conversionService = getObject(); ConverterRegistry registry = (ConverterRegistry) conversionService; // register converters that need a nested conversion service registry.addConverter(new MyCustomConverter(conversionService)); }}
声明如下:
<bean id="conversionService" > <property name="converters"> <list> ... declare standard converters here ... </list> </property></bean>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)