I have a custom ConverterFactory implementation. I need to implement a WebMvcConfigurer bean to register it to the ConversionService like this:
@Component
public class CustomConverterFactoryAdder implements WebMvcConfigurer {
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverterFactory(new CustomConverterFactory());
}
}
It would be nice if I could just annotate the CustomConverterFactory class with @Component and have it auto-register at startup.
The best location to do this is in the ApplicationConversionService.addBeans method I think. It already adds GenericConverter, Converter, ... beans.
Comment From: bclozel
As noted in the reference documentation, the ConversionService used for the web application is different from the one used for core concerns, such as properties binding.
If we were to provide such a feature, this would not just apply to the web bits. We've considered this approach in #15019 and declined it. I'm declining this issue for the same reasons. Thanks for raising this!