您当前的位置: 首页 >  spring boot

喜欢猪猪

暂无认证

  • 1浏览

    0关注

    228博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

spring boot 关于路由大小写的问题

喜欢猪猪 发布时间:2020-03-20 09:45:26 ,浏览量:1

C#项目转Java项目的时候,出现的一些问题,由于C#没有区分大小写路由,前端页面也不够规范,同一个页面,有的是大写,有的是小写,这个在java里面就必须进行javaconfig的配置处理

具体需要添加一个统一的类来路由到页面

package com.ly.wanle.admin.web.config;

import org.springframework.util.AntPathMatcher;//需要特别注意这一行注释的问题
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 WebConfig extends WebMvcConfigurationSupport {

    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        AntPathMatcher matcher = new AntPathMatcher();
        matcher.setCaseSensitive(false);
        configurer.setPathMatcher(matcher);
    }
}

 

添加这个注释之后,就能大小写路由兼容了。

关注
打赏
1648795721
查看更多评论
立即登录/注册

微信扫码登录

0.0379s