Skip to content

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

@claudenobs

Description

@claudenobs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions