use of org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter in project spring-framework by spring-projects.
the class DelegatingWebFluxConfigurationIntegrationTests method requestMappingHandlerAdapterWithPrimaryUsesQualifiedConversionService.
@Test
void requestMappingHandlerAdapterWithPrimaryUsesQualifiedConversionService() {
load(registerPrimaryBean("testConversionService", FormattingConversionService.class));
RequestMappingHandlerAdapter mappingHandlerAdapter = this.context.getBean(RequestMappingHandlerAdapter.class);
assertThat(mappingHandlerAdapter.getWebBindingInitializer()).hasFieldOrPropertyWithValue("conversionService", this.context.getBean("webFluxConversionService"));
assertThat(this.context.getBeansOfType(FormattingConversionService.class)).containsOnlyKeys("webFluxConversionService", "testConversionService");
}
use of org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter in project spring-boot by spring-projects.
the class WebFluxAutoConfigurationTests method shouldRegisterCustomHandlerMethodArgumentResolver.
@SuppressWarnings("unchecked")
@Test
void shouldRegisterCustomHandlerMethodArgumentResolver() {
this.contextRunner.withUserConfiguration(CustomArgumentResolvers.class).run((context) -> {
RequestMappingHandlerAdapter adapter = context.getBean(RequestMappingHandlerAdapter.class);
List<HandlerMethodArgumentResolver> customResolvers = (List<HandlerMethodArgumentResolver>) ReflectionTestUtils.getField(adapter.getArgumentResolverConfigurer(), "customResolvers");
assertThat(customResolvers).contains(context.getBean("firstResolver", HandlerMethodArgumentResolver.class), context.getBean("secondResolver", HandlerMethodArgumentResolver.class));
});
}
use of org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter in project spring-boot by spring-projects.
the class WebFluxAnnotationAutoConfigurationTests method shouldRegisterCustomHandlerMethodArgumentResolver.
@Test
public void shouldRegisterCustomHandlerMethodArgumentResolver() throws Exception {
load(CustomArgumentResolvers.class);
RequestMappingHandlerAdapter adapter = this.context.getBean(RequestMappingHandlerAdapter.class);
assertThat(adapter.getArgumentResolvers()).contains(this.context.getBean("firstResolver", HandlerMethodArgumentResolver.class), this.context.getBean("secondResolver", HandlerMethodArgumentResolver.class));
}
use of org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter in project spring-framework by spring-projects.
the class DelegatingWebFluxConfigurationIntegrationTests method requestMappingHandlerAdapterWithPrimaryUsesQualifiedReactiveAdapterRegistry.
@Test
void requestMappingHandlerAdapterWithPrimaryUsesQualifiedReactiveAdapterRegistry() {
load(registerPrimaryBean("testReactiveAdapterRegistry", ReactiveAdapterRegistry.class));
RequestMappingHandlerAdapter mappingHandlerAdapter = this.context.getBean(RequestMappingHandlerAdapter.class);
assertThat(mappingHandlerAdapter.getReactiveAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
assertThat(this.context.getBeansOfType(ReactiveAdapterRegistry.class)).containsOnlyKeys("webFluxAdapterRegistry", "testReactiveAdapterRegistry");
}
use of org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter in project spring-framework by spring-projects.
the class WebFluxConfigurationSupport method requestMappingHandlerAdapter.
@Bean
public RequestMappingHandlerAdapter requestMappingHandlerAdapter(@Qualifier("webFluxAdapterRegistry") ReactiveAdapterRegistry reactiveAdapterRegistry, ServerCodecConfigurer serverCodecConfigurer, @Qualifier("webFluxConversionService") FormattingConversionService conversionService, @Qualifier("webFluxValidator") Validator validator) {
RequestMappingHandlerAdapter adapter = createRequestMappingHandlerAdapter();
adapter.setMessageReaders(serverCodecConfigurer.getReaders());
adapter.setWebBindingInitializer(getConfigurableWebBindingInitializer(conversionService, validator));
adapter.setReactiveAdapterRegistry(reactiveAdapterRegistry);
ArgumentResolverConfigurer configurer = new ArgumentResolverConfigurer();
configureArgumentResolvers(configurer);
adapter.setArgumentResolverConfigurer(configurer);
return adapter;
}
Aggregations