question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SpringFormEncoder.class(When bodyType is MultipartFile[].class,files should not be override)

See original GitHub issue

it 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:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Been24commented, Oct 22, 2019

其实这个问题有人已经贡献改进源码了,可能下个版本就修复了,你也可以参照它使用的LinkedMultiValueMap来操作。 https://github.com/OpenFeign/feign-form/pull/74/commits/4131ead3593e81de87f8bfa62e730af58a8ee8e2

1reaction
y531110728commented, Oct 22, 2019

十分感谢,问题已经解决了,之前我改了那个foreach,不是用map接的,用的val,然后调用报错了。 val data = Collections.singletonMap(file.length == 0 ? “” : file[0].getName(), object);

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found