Search in sources :

Example 1 with PathMatchConfigurer

use of org.springframework.web.servlet.config.annotation.PathMatchConfigurer in project chassis by Kixeye.

the class SpringMvcConfiguration method requestMappingHandlerMapping.

/**
     * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
     * requests to annotated controllers.
     */
@Bean
@Override
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    PathMatchConfigurer configurer = new PathMatchConfigurer();
    configurePathMatch(configurer);
    RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping();
    handlerMapping.setOrder(0);
    handlerMapping.setDetectHandlerMethodsInAncestorContexts(true);
    handlerMapping.setInterceptors(getInterceptors());
    handlerMapping.setContentNegotiationManager(mvcContentNegotiationManager());
    if (configurer.isUseSuffixPatternMatch() != null) {
        handlerMapping.setUseSuffixPatternMatch(configurer.isUseSuffixPatternMatch());
    }
    if (configurer.isUseRegisteredSuffixPatternMatch() != null) {
        handlerMapping.setUseRegisteredSuffixPatternMatch(configurer.isUseRegisteredSuffixPatternMatch());
    }
    if (configurer.isUseTrailingSlashMatch() != null) {
        handlerMapping.setUseTrailingSlashMatch(configurer.isUseTrailingSlashMatch());
    }
    if (configurer.getPathMatcher() != null) {
        handlerMapping.setPathMatcher(configurer.getPathMatcher());
    }
    if (configurer.getUrlPathHelper() != null) {
        handlerMapping.setUrlPathHelper(configurer.getUrlPathHelper());
    }
    return handlerMapping;
}
Also used : RequestMappingHandlerMapping(org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping) PathMatchConfigurer(org.springframework.web.servlet.config.annotation.PathMatchConfigurer) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)1 PathMatchConfigurer (org.springframework.web.servlet.config.annotation.PathMatchConfigurer)1 RequestMappingHandlerMapping (org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping)1