From 55d4268448c4db6f475470363dc83858f2d9c16b Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 2 Dec 2016 20:41:39 -0500 Subject: [PATCH] ReactiveAdapterRegistry is a bean --- .../config/WebReactiveConfigurationSupport.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/config/WebReactiveConfigurationSupport.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/config/WebReactiveConfigurationSupport.java index 6c432a8182..a09fc4fd0b 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/config/WebReactiveConfigurationSupport.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/config/WebReactiveConfigurationSupport.java @@ -267,7 +267,7 @@ public class WebReactiveConfigurationSupport implements ApplicationContextAware RequestMappingHandlerAdapter adapter = createRequestMappingHandlerAdapter(); adapter.setMessageReaders(getMessageReaders()); adapter.setWebBindingInitializer(getConfigurableWebBindingInitializer()); - adapter.setReactiveAdapterRegistry(getReactiveAdapterRegistry()); + adapter.setReactiveAdapterRegistry(webReactiveAdapterRegistry()); List resolvers = new ArrayList<>(); addArgumentResolvers(resolvers); @@ -372,9 +372,10 @@ public class WebReactiveConfigurationSupport implements ApplicationContextAware } /** - * Override to plug in a custom {@link ReactiveAdapterRegistry}. + * Return a {@link ReactiveAdapterRegistry} to adapting reactive types. */ - protected ReactiveAdapterRegistry getReactiveAdapterRegistry() { + @Bean + public ReactiveAdapterRegistry webReactiveAdapterRegistry() { return new ReactiveAdapterRegistry(); } @@ -433,13 +434,13 @@ public class WebReactiveConfigurationSupport implements ApplicationContextAware @Bean public ResponseEntityResultHandler responseEntityResultHandler() { return new ResponseEntityResultHandler( - getMessageWriters(), webReactiveContentTypeResolver(), getReactiveAdapterRegistry()); + getMessageWriters(), webReactiveContentTypeResolver(), webReactiveAdapterRegistry()); } @Bean public ResponseBodyResultHandler responseBodyResultHandler() { return new ResponseBodyResultHandler( - getMessageWriters(), webReactiveContentTypeResolver(), getReactiveAdapterRegistry()); + getMessageWriters(), webReactiveContentTypeResolver(), webReactiveAdapterRegistry()); } /** @@ -505,7 +506,7 @@ public class WebReactiveConfigurationSupport implements ApplicationContextAware configureViewResolvers(registry); List resolvers = registry.getViewResolvers(); ViewResolutionResultHandler handler = new ViewResolutionResultHandler( - resolvers, webReactiveContentTypeResolver(), getReactiveAdapterRegistry()); + resolvers, webReactiveContentTypeResolver(), webReactiveAdapterRegistry()); handler.setDefaultViews(registry.getDefaultViews()); handler.setOrder(registry.getOrder()); return handler;