use of org.springframework.web.reactive.result.view.ViewResolutionResultHandler in project spring-boot by spring-projects.
the class WebFluxAnnotationAutoConfigurationTests method shouldRegisterViewResolvers.
@Test
public void shouldRegisterViewResolvers() throws Exception {
load(ViewResolvers.class);
ViewResolutionResultHandler resultHandler = this.context.getBean(ViewResolutionResultHandler.class);
assertThat(resultHandler.getViewResolvers()).containsExactly(this.context.getBean("aViewResolver", ViewResolver.class), this.context.getBean("anotherViewResolver", ViewResolver.class));
}
use of org.springframework.web.reactive.result.view.ViewResolutionResultHandler in project spring-framework by spring-projects.
the class WebFluxConfigurationSupport method viewResolutionResultHandler.
@Bean
public ViewResolutionResultHandler viewResolutionResultHandler() {
ViewResolverRegistry registry = new ViewResolverRegistry(getApplicationContext());
configureViewResolvers(registry);
List<ViewResolver> resolvers = registry.getViewResolvers();
ViewResolutionResultHandler handler = new ViewResolutionResultHandler(resolvers, webFluxContentTypeResolver(), webFluxAdapterRegistry());
handler.setDefaultViews(registry.getDefaultViews());
handler.setOrder(registry.getOrder());
return handler;
}
use of org.springframework.web.reactive.result.view.ViewResolutionResultHandler in project spring-framework by spring-projects.
the class WebFluxConfigurationSupportTests method viewResolutionResultHandler.
@Test
public void viewResolutionResultHandler() throws Exception {
ApplicationContext context = loadConfig(CustomViewResolverConfig.class);
String name = "viewResolutionResultHandler";
ViewResolutionResultHandler handler = context.getBean(name, ViewResolutionResultHandler.class);
assertNotNull(handler);
assertEquals(Ordered.LOWEST_PRECEDENCE, handler.getOrder());
List<ViewResolver> resolvers = handler.getViewResolvers();
assertEquals(1, resolvers.size());
assertEquals(FreeMarkerViewResolver.class, resolvers.get(0).getClass());
List<View> views = handler.getDefaultViews();
assertEquals(1, views.size());
MimeType type = MimeTypeUtils.parseMimeType("application/json;charset=UTF-8");
assertEquals(type, views.get(0).getSupportedMediaTypes().get(0));
}
Aggregations