Restore ResponseBodyEmitterReturnValueHandler constructor
Issue: SPR-15410
This commit is contained in:
@@ -32,6 +32,7 @@ import org.reactivestreams.Subscription;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ReactiveAdapter;
|
||||
import org.springframework.core.ReactiveAdapterRegistry;
|
||||
import org.springframework.core.task.SyncTaskExecutor;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.ServerSentEvent;
|
||||
@@ -78,6 +79,10 @@ class ReactiveTypeHandler {
|
||||
private final ContentNegotiationManager contentNegotiationManager;
|
||||
|
||||
|
||||
public ReactiveTypeHandler() {
|
||||
this(new ReactiveAdapterRegistry(), new SyncTaskExecutor(), new ContentNegotiationManager());
|
||||
}
|
||||
|
||||
ReactiveTypeHandler(ReactiveAdapterRegistry registry, TaskExecutor executor,
|
||||
ContentNegotiationManager manager) {
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
* such as {@link SseEmitter} including the same types wrapped with
|
||||
* {@link ResponseEntity}.
|
||||
*
|
||||
* <p>As of 5.0 also supports reactive return value types for any reactive
|
||||
* library with registered adapters in {@link ReactiveAdapterRegistry}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.2
|
||||
*/
|
||||
@@ -63,6 +66,28 @@ public class ResponseBodyEmitterReturnValueHandler implements HandlerMethodRetur
|
||||
private final ReactiveTypeHandler reactiveHandler;
|
||||
|
||||
|
||||
/**
|
||||
* Simple constructor with reactive type support based on a default instance of
|
||||
* {@link ReactiveAdapterRegistry},
|
||||
* {@link org.springframework.core.task.SyncTaskExecutor}, and
|
||||
* {@link ContentNegotiationManager} with an Accept header strategy.
|
||||
*/
|
||||
public ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters) {
|
||||
Assert.notEmpty(messageConverters, "HttpMessageConverter List must not be empty");
|
||||
this.messageConverters = messageConverters;
|
||||
this.reactiveHandler = new ReactiveTypeHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete constructor with pluggable "reactive" type support.
|
||||
*
|
||||
* @param messageConverters converters to write emitted objects with
|
||||
* @param reactiveRegistry for reactive return value type support
|
||||
* @param executor for blocking I/O writes of items emitted from reactive types
|
||||
* @param manager for detecting streaming media types
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters,
|
||||
ReactiveAdapterRegistry reactiveRegistry, TaskExecutor executor,
|
||||
ContentNegotiationManager manager) {
|
||||
|
||||
Reference in New Issue
Block a user