Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.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
Spring boot 如何在具有相同密钥的RestTemplate多部分上载中具有相同的插入顺序_Spring Boot_Multipartform Data_Resttemplate - Fatal编程技术网

Spring boot 如何在具有相同密钥的RestTemplate多部分上载中具有相同的插入顺序

Spring boot 如何在具有相同密钥的RestTemplate多部分上载中具有相同的插入顺序,spring-boot,multipartform-data,resttemplate,Spring Boot,Multipartform Data,Resttemplate,我有一个API,其中有文档和描述作为表单数据键,如下所示- 如何对文档上载具有相同的插入顺序。 formdata键在数组中失去其顺序 希望文档和说明按添加顺序发送。 如何维持相同的秩序 我的代码- MultiValueMap<String, Object> valueMap = new LinkedMultiValueMap<String, Object>(); for(i=0;i<5;i++) { Resource fileResource = new

我有一个API,其中有文档和描述作为表单数据键,如下所示-

如何对文档上载具有相同的插入顺序。 formdata键在数组中失去其顺序

希望文档和说明按添加顺序发送。 如何维持相同的秩序

我的代码-

MultiValueMap<String, Object> valueMap = new LinkedMultiValueMap<String, Object>();

for(i=0;i<5;i++) {
   Resource fileResource = new FileSystemResource(htmlFile);
   String descriptionJson = "{ "a" : "a"};
   valueMap.add("document" ,fileResource);
   valueMap.add("description" , descriptionJson);
}

HttpEntity<?> httpEntity = new HttpEntity<>(valueMap, httpHeaders);
Object postResponse = restTemplate.exchange(url, httpMethod, httpEntity, String.class);
MultiValueMap valueMap=新链接的MultiValueMap();

对于(i=0;iBut
LinkedMultiValueMap
虽然有顺序?所以它确实被发送出了顺序?文档中说它包装了LinkedHashMap和LinkedList。是的,发送时顺序被更改。