获取URL中的数据,
代码:
@RestController
@RequestMapping("/hello")
public class HelloController {
@Autowired
private PersonsService service;
@RequestMapping(value = "/queryOne/{id}", method = {RequestMethod.GET, RequestMethod.POST})
public Map<String, Object> queryOne(@PathVariable("id") String id) {
Map<String, Object> map = service.selectById(id);
return map;
}
请求:

本文介绍了一种使用Spring Boot实现的RESTful API设计,通过URL参数接收ID并返回相应的数据。具体展示了如何在HelloController类中定义路径/hello/queryOne/{id}
1万+

被折叠的 条评论
为什么被折叠?



