-
Notifications
You must be signed in to change notification settings - Fork 472
AnnotationMappingDiscoverer should read @RequestMapping#params() #467
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
Comments
odrotbohm
pushed a commit
that referenced
this issue
Jul 14, 2021
…ms = …) We now inspect the static request parameters declared in the actual request mapping and apply those values when building URIs pointing to those methods. Original pull request: #1576.
odrotbohm
added a commit
that referenced
this issue
Jul 14, 2021
General house keeping. Original pull request: #1576.
This should be in place thanks to @reda-alaoui's contribution. Minor comment on the original description: we do not add |
odrotbohm
added a commit
that referenced
this issue
Nov 23, 2021
The commits for #467 significantly degraded performance as CachingMappingDiscoverer.getParams(Method) doesn't properly cache the result of the call which causes quite expensive, unnecessarily repeated annotation lookups for the very same method. We also avoid the creation of an Optional instance for the sole purpose of a simple null check. Introduce FormatterFactory to potentially cache the to-String formatting functions and thus avoid repeated evaluation and Function object creation. We now also avoid the creation of ParamRequestCondition instances if no @RequestParams(params = …) values could be found in the first place.
odrotbohm
added a commit
that referenced
this issue
Nov 23, 2021
The commits for #467 significantly degraded performance as CachingMappingDiscoverer.getParams(Method) doesn't properly cache the result of the call which causes quite expensive, unnecessarily repeated annotation lookups for the very same method. We also avoid the creation of an Optional instance for the sole purpose of a simple null check. Introduce FormatterFactory to potentially cache the to-String formatting functions and thus avoid repeated evaluation and Function object creation. We now also avoid the creation of ParamRequestCondition instances if no @RequestParams(params = …) values could be found in the first place.
odrotbohm
added a commit
that referenced
this issue
Nov 23, 2021
The commits for #467 significantly degraded performance as CachingMappingDiscoverer.getParams(Method) doesn't properly cache the result of the call which causes quite expensive, unnecessarily repeated annotation lookups for the very same method. We also avoid the creation of an Optional instance for the sole purpose of a simple null check. Introduce FormatterFactory to potentially cache the to-String formatting functions and thus avoid repeated evaluation and Function object creation. We now also avoid the creation of ParamRequestCondition instances if no @RequestParams(params = …) values could be found in the first place.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@RequestMapping
allows to use requests' GET parameters to map incoming requests without having to inject parameters into a@RequestParam
annotated method parameter:This is pretty useful when you want clean API endpoints as well as clean code (e.g. no need of single method delegating to other methods thanks to a switch/case on the parameter's value).
It could be great if
linkTo(methodOn(FooBarApi.class).get())
took theseparams
into account as well, by generating for the above example at least:And why not:
But iff no
@RequestParam
matched thistwo
parameter (otherwise, the actual value would have been given when callinglinkTo(methodOn(FooBarApi.class).get(twoParamValue))
).What do you think about it?
Technically, when dealing with the
@RequestMapping
annotation, theAnnotationMappingDiscoverer
instance used inControllerLinkBuilderFactory
could instantiate an neworg.springframework.web.servlet.mvc.condition.ParamsRequestCondition
to parse thosesparams
.The text was updated successfully, but these errors were encountered: