Skip to content

ValidationBindHandler fails if setters cannot be accessed #17424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
philwebb opened this issue Jul 4, 2019 · 1 comment
Closed

ValidationBindHandler fails if setters cannot be accessed #17424

philwebb opened this issue Jul 4, 2019 · 1 comment
Labels
type: bug A general bug
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented Jul 4, 2019

The ValidationBindHandler uses BeanPropertyBindingResult to collect errors. This makes the assumption that bean properties are available as standard visible getters/setters. Whilst this is a relatively safe assumption for 2.1.x, with the constructor binding of 2.2.x we should no longer assume that properties have getters. We also want to support package private binding (#17394) which is not supported by BeanPropertyBindingResult.

@philwebb philwebb added the type: bug A general bug label Jul 4, 2019
@philwebb philwebb added this to the 2.2.x milestone Jul 4, 2019
@philwebb
Copy link
Member Author

philwebb commented Jul 4, 2019

Since the fix is a little risky, and the bug is less likely to appear in 2.1.x I'm going to only target 2.2.x.

@philwebb philwebb modified the milestones: 2.2.x, 2.2.0.M5 Jul 4, 2019
mbhave added a commit that referenced this issue Mar 12, 2021
gh-17424 updated `ValidationBindHandler` so that it would
only look at bound values when validating. This commit updates
`ValidationBindHandler` to use Spring Framework's `BeanPropertyBindingResult`.
This means that for fields that are not bound, JavaBean accessor methods can
be used to get the value to validate.

Fixes gh-25356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant