Skip to content

PropertyEditors registered in context not thread-safe for DataBinder [SPR-2009] #6702

@spring-projects-issues

Description

@spring-projects-issues

Thomas Whitmore opened SPR-2009 and commented

Custom PropertyEditors registered in the context could be widely useful for Data Binding, but unfortunately are not used in a thread-safe manner by the Data Binder.

The Bean Factory does use these in a thread-safe manner; by synchronizing; but it is not clear that this would be suitable for heavy load of request-processing. Synchronizing on each individual editor, or establishing a well-defined API to 'duplicate' editors treating the original only as a template, might be solutions.

For the moment I'm keeping registration of these to the Controller. InitBinder() method - instantiating the editors there. This is safe, but if editors worked better I could quite widely genericize my code.

Other people have noticed small versions of this problem (#4799) but I think this may be a fairly major case. OTOH, maybe you've already got this addressed for the Spring-2 target.


What I was intending to do, that could be useful at the Framework level, is a ' Reference Editor ' converting between Hibernate object references <-> IDs in string form. Registering one of these with for your intended Target Class would then make all fields, combo boxes etc referencing this type automatically bound. My code picks up Hibernate metadata & types of simple identifiers to parse these automatically.

FYI.

Keep up the good work!

Cheers,
Thomas


Affects: 1.2.8

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions