I have a Spring REST controller:
@RestController
@RequestMapping("v1/employee")
public class controller1 {
getMethod(@PathVariable String param1, String param2){}
postMethod(){}
}
I want to introduce a new endpoint version v2 that resolves the params: param1,param2 and forward to the v1 request urls.
I want the new clients to be able to call v2 while the old clients are still able to call v1 endpoints. I looked at Interceptors and Filters. So I should either,
- forward the requests to v1 or,
- call controller methods internally
Is there a better way to do this? Thanks.