I am trying to implement API versioning in my Spring application.
So I want to do something like this api_url/{version}/{params}
Lets say I have changed one of the endpoint functions, so I can map the new function to new url with new version. But I want the other unchanged functions to be mapped to both version urls, like api_url/{old-version}/{old-params} and api_url/{new-version}/{old-params}
So if I can implement something like this, it will help me from saving duplication of code in my Java class. How do I do this. Currently @RequestMapping only allows me to specify one value.
You can use comma separated lists in the request mapping annotation.
@RequestMapping(value={"/url/{id}","/url2/{id}"}, method=RequestMethod.GET)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With