1、get方式?传参:
http://localhost:8089/show/?id=123 @GetMapping("/show") public ResponseEntityshow(String id) { return ResponseEntity.ok(id); }
2、get方式路径传参
```java http://localhost:8089/show/123 @GetMapping("/show/{id}") public ResponseEntityshow(@PathVariable(name = "id") String id) { return ResponseEntity.ok(id); }
3、javabeen接收参数
//实体类 import lombok.Data; import java.io.Serializable; @Data public class UserDTO implements Serializable { private String idno; private String name; } -------------------------------------------------------------- @PostMapping("/postShow") public ResponseEntitypostShow(@RequestBody User user) { logger.info("返回参数:"+ResponseEntity.ok(user.getIdno())); return ResponseEntity.ok(Cfcactive.getIdno()); }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)