Skip to content

Spring MVC @ResponseBody handling of Flux<?> inconsistent when type of result is unknown [SPR-15456] #20017

Closed
@spring-projects-issues

Description

@spring-projects-issues

Dave Syer opened SPR-15456 and commented

I would expect this:

@GetMapping("/empty")
public Flux<Object> empty() {
     return Flux.fromIterable(Collections.emptyList());
}

to produce an identical result to this:

@GetMapping("/empty")
public Flux<String> empty() {
     return Flux.fromIterable(Collections.emptyList());
}

But it doesn't (the former is "null" and the latter is "[]"). I guess maybe the "null" is a bug?

If the Flux is not empty, then both signatures should also probably produce the same result, but doesn't (the strings get concatented and the objects get converted)? Or maybe I'm missing something.


Affects: 5.0 RC1

Issue Links:

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