SpringFormEncoder.class(When bodyType is MultipartFile[].class,files should not be override)
See original GitHub issueit happens line 67-69 in the source code of SpringFormEncoder.class, because each file has same file.getName()… **``` if (bodyType.equals(MultipartFile[].class)) { val files = (MultipartFile[]) object; val data = new HashMap<String, Object>(files.length, 1.F); for (val file : files) { data.put(file.getName(), file); } super.encode(data, MAP_STRING_WILDCARD, template); }
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
File upload spring cloud feign client - java - Stack Overflow
After few days searching a solution I found this. You should start to add feign form for spring dependency :
Read more >OpenFeign - Bountysource
Pojo encoder not considered the super class attributes. ... SpringFormEncoder.class(When bodyType is MultipartFile[].class,files should not be override) $ 0.
Read more >File Upload With Open Feign - Baeldung
Learn how to implement a Multipart File upload using OpenFeign. ... Note that FeignSupportConfig does not need to be annotated with ...
Read more >spring cloud feign support file upload - BurningBright
1 2 3 4, copy feign.codec.EncodeException: class [Lorg.springframework.web.multipart.MultipartFile; is not a type supported by this encoder.
Read more >MultipartFile (Spring Framework 6.0.3 API)
Return the original filename in the client's filesystem. This may contain path information depending on the browser used, but it typically will not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
其实这个问题有人已经贡献改进源码了,可能下个版本就修复了,你也可以参照它使用的LinkedMultiValueMap来操作。 https://github.com/OpenFeign/feign-form/pull/74/commits/4131ead3593e81de87f8bfa62e730af58a8ee8e2
十分感谢,问题已经解决了,之前我改了那个foreach,不是用map接的,用的val,然后调用报错了。 val data = Collections.singletonMap(file.length == 0 ? “” : file[0].getName(), object);