Skip to content

Commit 03eb6f7

Browse files
committed
Improve check for actual return value type
Issue: SPR-15910
1 parent 39cefb5 commit 03eb6f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ protected Mono<Void> writeBody(@Nullable Object body, MethodParameter bodyParame
101101
}
102102
else {
103103
publisher = Mono.justOrEmpty(body);
104-
elementType = (bodyClass == null && body != null ? ResolvableType.forInstance(body) : bodyType);
104+
elementType = ((bodyClass == null || bodyClass.equals(Object.class)) && body != null ?
105+
ResolvableType.forInstance(body) : bodyType);
105106
}
106107

107108
if (void.class == elementType.getRawClass() || Void.class == elementType.getRawClass()) {

0 commit comments

Comments
 (0)