use of org.springframework.web.reactive.result.view.freemarker.FreeMarkerViewResolver in project spring-boot by spring-projects.
the class FreeMarkerReactiveWebConfiguration method freeMarkerViewResolver.
@Bean
@ConditionalOnMissingBean(name = "freeMarkerViewResolver")
@ConditionalOnProperty(name = "spring.freemarker.enabled", matchIfMissing = true)
FreeMarkerViewResolver freeMarkerViewResolver() {
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
resolver.setPrefix(getProperties().getPrefix());
resolver.setSuffix(getProperties().getSuffix());
resolver.setRequestContextAttribute(getProperties().getRequestContextAttribute());
resolver.setViewNames(getProperties().getViewNames());
return resolver;
}
use of org.springframework.web.reactive.result.view.freemarker.FreeMarkerViewResolver in project spring-boot by spring-projects.
the class FreeMarkerAutoConfigurationReactiveIntegrationTests method render.
private MockServerWebExchange render(ApplicationContext context, String viewName) {
FreeMarkerViewResolver resolver = context.getBean(FreeMarkerViewResolver.class);
Mono<View> view = resolver.resolveViewName(viewName, Locale.UK);
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/path"));
view.flatMap((v) -> v.render(null, MediaType.TEXT_HTML, exchange)).block(Duration.ofSeconds(30));
return exchange;
}
Aggregations