zoukankan      html  css  js  c++  java
  • 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");
        }
     
  • 相关阅读:
    排序算法之--堆排序
    排序算法之--插入排序
    排序算法之--直接选择排序
    排序算法之--快速排序(及优化测试亿级100_000_000用时)
    分布式计算--(分布式+多进程+多线程+多协程)
    HDU
    2019牛客多校第四场D-triples I 贪心
    Interview_C++_day8
    Interview_C++_day7
    Interview_C++_day6
  • 原文地址:https://www.cnblogs.com/codinghard/p/14833365.html
Copyright © 2011-2022 走看看