I searched for the below problem, but couldn\'t find an answer.
I want to use spring\'s conversion service by writing my custom converter that implements org.spri
This variant works for me.
If you use java configuration, you can add your converters to existing GenericConversionService
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Autowired.html
Config methods may have an arbitrary name and any number of arguments; each of those arguments will be autowired with a matching bean in the Spring container. Bean property setter methods are effectively just a special case of such a general config method. Such config methods do not have to be public.
@Configuration
class MyConfig {
@Autowired
void conversionService(GenericConversionService genericConversionService) {
genericConversionService.addConverter(String.class, UUID.class, UUID::fromString);
genericConversionService.addConverter(String.class, DateTime.class, DateTime::parse);
genericConversionService.addConverter(String.class, EnumState.class, EnumState::valueOf);
}
}