For the class
class Request {
private String ftr;
// more properties
}
And the method in controller class
@GetMapping
public String list(@Valid Request request) {
//...
}
When I send a request to the method the url is https://example.com?ftr=sms
Is it possible to have an alias to a query parameter like in the class
class Request {
@QueryParameter(name="ftr")
private String filter;
// ...
}
And to map same request URL to this class?
Comment From: sbrannen
As far as I know, there is no mechanism that supports aliases for properties in web data binding.
As a workaround, have you considered introducing a filter
property alongside the ftr
property in your Request
class, where the getFilter()
and setFilter()
JavaBean methods simply delegate to getFtr()
and setFtr()
, respectively?
Comment From: sbrannen
See also #18012 and related issues linked from there.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.