@RestController()
@RequestMapping("/v1/e")
public class EC {
@PostMapping(path = "{document}", consumes = "application/json", produces = "application/json")
public ResponseEntity<InputStreamResource> createDocument(@PathVariable Dtype document,@RequestBody String data){
//code
}
我正在尝试向邮递员发出发帖请求,以下是我用来发帖的URL
http:// localhost:8080 / v1 / e?document = E_PC
但是,邮递员出现以下错误
{
"timestamp": "2020-08-05T02:22:03.008+0000",
"status": 404,
"error": "Not Found",
"message": "Not Found",
"path": "/v1/e"
}
答案 0 :(得分:0)
您还可以如下使用:
@RestController
@RequestMapping("/v1/e")
public class EC {
@PostMapping
public ResponseEntity<?> createDocument(@RequestParam("document") String document){
//code
}
}
您的POST REQUEST
是http://localhost:8080/v1/e?document=E_PC