I will try to shed more detailed light on this issue.
Let's start with the semantics " Query Parameter vs. Query Parameter" , respectively @QueryParam and @RequestParam
The request parameter in accordance with the HTTP specification, as well as in accordance with the JAX-RS implementation of this annotation ( @QueryParam ) represents the parameter found in the query string. those. The string that follows the question mark in the full query URL.
The request parameter in accordance with the HTTP specification, as well as in accordance with the implementation of this annotation ( @RequestParam ) Spring MVC (org.springframework.web.bind.annotation) represents the HTTP request parameter, and to be clear here, it does not indicate what type of parameter is it - request, header, body, etc.
Now let's talk about the implementation itself.
@QueryParam
@QueryParam refers to JAX-RS , which states :
@QueryParam Binds the value (s) of an HTTP request parameter to a resource method parameter, a resource class field, or a property of a component of a resource class
Note that this is a query parameter that is bound to the parameter of the resource method (that is, the parameter in the query string).
@RequestParam
@RequestParam on the other hand, is owned by the Spring Framework, which claims that:
The @RequestParam annotation indicates that the method parameter should be associated with the web request parameter.
• In Spring MVC, “query parameters” are mapped to query parameters, form data, and details in multicomponent queries. This is due to the fact that the Servlet API combines the request parameters and form data into one card called “parameters”, which includes an automatic analysis of the request body.
Therefore, I think that names can really be a little misleading, but after you delve into them a little more, they speak for themselves. Just try to stick to one when you only need a query parameter, and the other when you need any query parameter.