【发布时间】:2018-04-10 16:04:08
【问题描述】:
@RequestMapping(value = "/{userId:\\d+}", method = RequestMethod.DELETE)
public void delete(@PathVariable Long userId) {
try{
this.authorService.delete(userId);
}catch(Exception e){
throw new RuntimeException("delete error");
}
}
有人知道我应该为这个定义“/{userId:\d+}”匹配什么 url,你能给我一个例子,比如“/userid=1”,对吗?
我猜这个定义像这样 "/{userId:\d+}" ,在 url 中使用正则表达式来确保它传递一个数字参数。我不确定,如果有人知道,请给我一个链接进一步学习,谢谢!
【问题讨论】:
标签: java spring-boot request-mapping