Skip to content

Align @RequestPart support in WebFlux with Spring MVC #22973

Closed
@andrej-urvantsev

Description

@andrej-urvantsev

Affects: 5.1.6


After upgrading Spring Boot from 2.0.2 to 2.1.4 we started to see an issue with multipart form data uploading:

@PostMapping(value = "/{id}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public Mono<Void> store(@PathVariable final String id,
        @RequestPart("metadata") final Map<String, String> metadata,
        @RequestPart("fieldOne") final List<String> fieldOne,
        @RequestPart("fieldTwo") final List<Double> fieldTwo)

That worked on spring boot 2.0.2, but on 2.1.4 it fails with decoding exception:

Cannot deserialize instance of `java.lang.Double` out of START_ARRAY token

So it actually tries to deserialize list of doubles as just a Double.

As a workaround we've changed method signature to use Double[] instead of List. After that it works as expected.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions