Skip to content
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

Align validation metadata handling in PayloadMethodArgumentResolver #21852

Closed
spring-projects-issues opened this issue Oct 1, 2018 · 2 comments
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Gary Russell opened SPR-17319 and commented

Currently, the validate() method parses the parameter annotations on every call.

It should be possible to cache the results and only parse on the first call.


Affects: 5.1 GA

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This applies to several method argument resolvers in the web space as well. A consistent caching strategy for validation metadata across all of them sounds worthwhile.

@spring-projects-issues spring-projects-issues added in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.x Backlog milestone Jan 11, 2019
@jhoeller jhoeller self-assigned this Aug 14, 2023
@jhoeller jhoeller modified the milestones: 6.x Backlog, 6.1.0-RC1 Aug 14, 2023
@jhoeller jhoeller changed the title Consider caching PayloadArgumentResolver MethodParameter parsing [SPR-17319] Cache validation metadata in PayloadMethodArgumentResolver Aug 16, 2023
@jhoeller jhoeller added in: web Issues in web modules (web, webmvc, webflux, websocket) and removed in: web Issues in web modules (web, webmvc, webflux, websocket) labels Aug 16, 2023
@jhoeller
Copy link
Contributor

A recent related change #26787 - reusing this ValidationAnnotationUtils should go along nicely here.

@jhoeller jhoeller changed the title Cache validation metadata in PayloadMethodArgumentResolver Align validation metadata handling in PayloadMethodArgumentResolver Aug 16, 2023
@jhoeller jhoeller modified the milestones: 6.1.0-RC1, 6.0.12 Aug 16, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.3.x labels Aug 16, 2023
jhoeller added a commit that referenced this issue Aug 16, 2023
Reuses ValidationAnnotationUtils which is slightly optimized for the detection of Spring's Validated annotation now, also to the benefit of common web scenarios.

Closes gh-21852

(cherry picked from commit c7269fe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants