Search in sources :

Example 1 with RouterFunctionMapping

use of org.springframework.web.servlet.function.support.RouterFunctionMapping in project spring-framework by spring-projects.

the class WebMvcConfigurationSupport method routerFunctionMapping.

/**
 * Return a {@link RouterFunctionMapping} ordered at 3 to map
 * {@linkplain org.springframework.web.servlet.function.RouterFunction router functions}.
 * Consider overriding one of these other more fine-grained methods:
 * <ul>
 * <li>{@link #addInterceptors} for adding handler interceptors.
 * <li>{@link #addCorsMappings} to configure cross origin requests processing.
 * <li>{@link #configureMessageConverters} for adding custom message converters.
 * <li>{@link #configurePathMatch(PathMatchConfigurer)} for customizing the {@link PathPatternParser}.
 * </ul>
 * @since 5.2
 */
@Bean
public RouterFunctionMapping routerFunctionMapping(@Qualifier("mvcConversionService") FormattingConversionService conversionService, @Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider) {
    RouterFunctionMapping mapping = new RouterFunctionMapping();
    mapping.setOrder(3);
    mapping.setInterceptors(getInterceptors(conversionService, resourceUrlProvider));
    mapping.setCorsConfigurations(getCorsConfigurations());
    mapping.setMessageConverters(getMessageConverters());
    PathPatternParser patternParser = getPathMatchConfigurer().getPatternParser();
    if (patternParser != null) {
        mapping.setPatternParser(patternParser);
    }
    return mapping;
}
Also used : RouterFunctionMapping(org.springframework.web.servlet.function.support.RouterFunctionMapping) PathPatternParser(org.springframework.web.util.pattern.PathPatternParser) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)1 RouterFunctionMapping (org.springframework.web.servlet.function.support.RouterFunctionMapping)1 PathPatternParser (org.springframework.web.util.pattern.PathPatternParser)1