You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a formatter registry capability local to a controller [SPR-7773] #12429
Currently a single ConversionService is used globally in a DispatcherServlet. It would be useful for controllers to be able to register converters and formatters locally for a given DataBinder instance without affecting the global ConversionService instance (for example ROO-1655).
Something along the lines of:
DataBinder.getFormatterRegistry().add(..)
I'm introducing addCustomFormatter(Formatter formatter, String... fields) and addCustomFormatter(Formatter formatter, Class... fieldTypes) to DataBinder, internally adapting the given Formatter to a PropertyEditor and registering that adapter with the underlying PropertyEditorRegistry, following the usual rules there. This is a quite simple and straighforward approach which should hopefully cover the typical use case here, without having to build an extra local ConversionService underneath the covers.
Activity
spring-projects-issues commentedon May 12, 2015
Juergen Hoeller commented
I'm introducing
addCustomFormatter(Formatter formatter, String... fields)andaddCustomFormatter(Formatter formatter, Class... fieldTypes)toDataBinder, internally adapting the givenFormatterto aPropertyEditorand registering that adapter with the underlyingPropertyEditorRegistry, following the usual rules there. This is a quite simple and straighforward approach which should hopefully cover the typical use case here, without having to build an extra localConversionServiceunderneath the covers.Juergen