我有以下三个REST API方法:
@RequestMapping(value = "/{name1}", method = RequestMethod.GET)
public Object retrieve(@PathVariable String name1) throws UnsupportedEncodingException {
return configService.getConfig("frontend", name1);
}
@RequestMapping(value = "/{name1}/{name2}", method = RequestMethod.GET)
public Object retrieve(@PathVariable String name1, @PathVariable String name2) throws UnsupportedEncodingException {
return configService.getConfig("frontend", name1, name2);
}
@RequestMapping(value = "/{name1}/{name2}/{name3}", method = RequestMethod.GET)
public Object retrieve(@PathVariable String name1, @PathVariable String name2, @PathVariable String name3) {
return configService.getConfig("frontend", name1, name2,name3);
}
getConfig方法配置为接受多个参数,例如:
public Object getConfig(String... names) {
我的问题是:是否可能只使用一个方法/RequestMapping来实现上述RequestMapping?谢谢。