Spring boot路径匹配配置

package com.test;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;


@Configuration
public class UrlMatchConfig extends WebMvcConfigurationSupport {

    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        //setUseSuffixPatternMatch 自动过滤后缀'.do'
        //setUseTrailingSlashMatch 自动去掉'/'
        configurer
                .setUseSuffixPatternMatch(true)
                .setUseTrailingSlashMatch(true);
    }
}

你可能感兴趣的:(Spring boot路径匹配配置)