• Invalid mapping pattern detected: /**/*.css ^ No more pattern data allowed after {*...} or ** pattern element


    报错:

    ***************************
    APPLICATION FAILED TO START
    ***************************
    
    Description:
    
    Invalid mapping pattern detected: /**/*.css
    ^
    No more pattern data allowed after {*...} or ** pattern element
    
    Action:
    
    Fix this pattern in your application or switch to the legacy parser implementation with `spring.mvc.pathpattern.matching-strategy=ant_path_matcher`.
    
    
    Process finished with exit code 0

    定位:

        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(alphaInterceptor) //拦截一切请求
               .excludePathPatterns("/**/*.css","/**/*.js","/**/*.png","/**/*.jpg","/**/*.jpeg") //排除访问静态资源,所有目录下的cs文件
                .addPathPatterns("/register","/login");

    原因:

    路径通配问题,查找发现是spring升级到5.3之后路径通配发生了变化,官方给出的解释是“In Spring MVC, the path was previously analyzed by AntPathMatcher, but it was changed to use PathPatternParser introduced in WebFlux from Spring 5.3.0.”通配符发生了变化。把/**/*.css 改为 /*/*.css即可。

        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(alphaInterceptor) //拦截一切请求
                    .excludePathPatterns("/*/*.css","/*/*.js","/*/*.png","/*/*.jpg","/*/*.jpeg") //排除访问静态资源,所有目录下的cs文件
                    .addPathPatterns("/register","/login");
        }
     
  • 相关阅读:
    洛谷 P1037 产生数
    阿里实习储备知识
    腾讯后台开发面试总结(别人的)
    两个栈实现队列的功能
    栈里的元素升序排列
    二叉树路径和
    硬币组合问题
    九月十月百度,迅雷,华为,阿里巴巴笔试面试六十题(第411~470题)
    轻松搞定面试中的二叉树题目
    july教你如何迅速秒杀掉:99%的海量数据处理面试题
  • 原文地址:https://www.cnblogs.com/codinghard/p/14833365.html
Copyright © 2020-2023  润新知