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

Avoid re-retrieval of @ResponseStatus annotation for each request [SPR-15227] #19792

Closed
spring-issuemaster opened this Issue Feb 6, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Feb 6, 2017

Violeta Georgieva opened SPR-15227 and commented

Hi,

Currently @ResponseStatus is calculated every time when a request is performed.

https://github.com/spring-projects/spring-framework/blob/master/spring-webflux/src/main/java/org/springframework/web/reactive/result/AbstractHandlerResultHandler.java#L166

It is better to calculate it when constructing the MethodParameter.

Regards,
Violeta


Affects: 4.3.7, 5.0 M4

Issue Links:

  • #19950 Minimize reflective interaction with annotation instances during retrieval
@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 10, 2017

Brian Clozel commented

This turns out to be a more general issue with AnnotatedElementUtils not caching annotation resolution (vs. AnnotatedUtils, which has a local cache for that). So we'll try to solve this issue at the AnnotatedElementUtils level.

If that doesn't work out, we can always solve that at the HandlerMethod level.

According to Violeta Georgieva, this performance issue shows even when the annotation is not present on the handler method, which means that the local cache should also cache null values (i.e. the annotation is not present).

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 8, 2017

Juergen Hoeller commented

I'm moving @ResponseStatus resolution to the cached HandlerMethod, with the InvocableHandlerMethod variants just picking it up from there. This allows for caching the actual HttpStatus object, not even having to call the (reflective) ResponseStatus.code() method for each request anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.