mattbertolini / spring-annotated-web-data-binder

Bind query params, form data, headers, cookies, session data, and more to a Java bean in Spring MVC and Spring WebFlux
Apache License 2.0
27 stars 4 forks source link

Handling MultipartFile #2

Closed nikolavojicic closed 3 years ago

nikolavojicic commented 3 years ago

Does this library work with MultipartFile? Other fields of consumes = {"multipart/form-data"} request are handled properly by @FormParameter. But MultipartFile is always set to null.

mattbertolini commented 3 years ago

Multipart is unsupported at this time. It's on my TODO list but Spring doesn't make it easy to support (I would have to duplicate quite a bit). Any support you're seeing right now is purely coincidental.

Are you using Spring MVC or WebFlux?

nikolavojicic commented 3 years ago

I'm using Spring MVC.

The workaround is to keep MultipartFile separated from other params and use @RequestParam for it.

mattbertolini commented 3 years ago

Correct. That is the workaround. I have a branch started for this support so I might be pushing some snapshots soon. I'll keep you posted on this ticket.

mattbertolini commented 3 years ago

I have a draft PR #3 opened with MultipartFile support. You can take a look if you want. I've also published a snapshot release (0.3.0-SNAPSHOT) to Maven Central snapshot repository (https://oss.sonatype.org/content/repositories/snapshots/).

It would be much appreciated if you could test this out and see if it meets your needs. If it does, I can cut a release and publish.

nikolavojicic commented 3 years ago

Thanks for this feature!

I ran all my tests and it works.

mattbertolini commented 3 years ago

Glad to hear that. I will publish a release with these changes sometime in the next day or so. I will post here when that is complete.

mattbertolini commented 3 years ago

Release 0.3.0 has been published. It should appear in Maven Central shortly. Please try it out and let me know if it works for you. I will keep this issue open and wait to hear back for confirmation. Thanks.

nikolavojicic commented 3 years ago

Everything works fine.

mattbertolini commented 3 years ago

Excellent! Thanks for creating the feature request. I hope the library works out for you.