spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Allow null handling with @InitBinder & PropertyEditor/Converter/Formatter to handle null values.

Open claudenobs opened this issue 4 months ago • 0 comments

With @InitBinder it is currently possible to register various property handlers to customize the web request data binding via binder.registerCustomEditor(Class<?>, String, PropertyEditor), binder.addCustomFormatter(Formatter<?>, String...) or using a Converter. However none of these get called if the property is absent from the request.

I don't know if this is a bug or desired behavour, but there should be at least the possibility to handle such cases.

Current Behavior Neither registered PropertyEditor nor Formatter nor Converter get invoked when a property is missing from the request. That is it only works if the property is explicitly sent as `null in the request.

Desired Behavior Allow for PropertyEditor / Formatter / Converter to get called if an Optional/@Nullableproperty is absent from the request. And not just when explicitely sent asnull.

claudenobs avatar Jul 29 '25 15:07 claudenobs