Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 多个Spring@RequestMapping头_Java_Spring Boot_Post_Request Mapping - Fatal编程技术网

Java 多个Spring@RequestMapping头

Java 多个Spring@RequestMapping头,java,spring-boot,post,request-mapping,Java,Spring Boot,Post,Request Mapping,我的问题很简单,它可能在同一个方法上使用两个不同的内容类型头 就像这样: @RequestMapping(value = "/provider", method = RequestMethod.POST, headers = "Accept=application/json,content-type=multipart/form-data") @ResponseBody @Transactional public ResponseEntity<String>

我的问题很简单,它可能在同一个方法上使用两个不同的内容类型头

就像这样:

@RequestMapping(value = "/provider", method = RequestMethod.POST, headers = "Accept=application/json,content-type=multipart/form-data")
    @ResponseBody
    @Transactional
    public ResponseEntity<String> createProviderQuote(
            @RequestParam(value = "work", required = true) String workId,
            UriComponentsBuilder uriComponentsBuilder, final HttpServletRequest request) {
}

非常感谢

是的,您可以-要设置端点将接受和返回的内容,您需要使用
消耗
生成
属性od
@RequestMapping
注释

@RequestMapping(value = "/provider", 
                method = RequestMethod.POST, 
                produces = {MediaType.APPLICATION_JSON, MediaType.MULTIPART_FORM_DATA})
当然,由于您的需求,您需要在前端正确地支持这一点

@RequestMapping(value = "/provider", 
                method = RequestMethod.POST, 
                produces = {MediaType.APPLICATION_JSON, MediaType.MULTIPART_FORM_DATA})