【发布时间】:2022-07-05 14:45:02
【问题描述】:
当我将 Spring Boot API 升级到 2.6.1 版本时,我收到了这个错误。
我的 API 中的 URL ant 匹配器喜欢:/v1/token/**。
此错误的任何解决方案:
Invalid mapping pattern detected: /**/swagger-ui/**
^
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.pathmatch.matching-strategy=ant_path_matcher'.
我已经将spring.mvc.pathpattern.matching-strategy=ant_path_matcher 添加到application.properties 文件中,但它不起作用。
【问题讨论】:
-
您能否发布您的配置以查看更多详细信息。虽然基本上你不能使用所有匹配的通配符
**后跟 hardcdoed 文字和另一个通配符。 -
这是我的配置:webSecurity.ignoring().antMatchers("/token/**", "/v1/token/**", "/v2/token/**", " /v2/authenticate/**", "/v3/api-docs/**", "/swagger-ui.html", "/swagger-ui/index.html");
-
我无法从提供的错误中找到匹配器。您也可以发布堆栈跟踪吗?并将您的配置添加到您的答案中。如果堆栈跟踪告诉您一行代码,请也包括它们。
-
这是由于spring 5.3.x upgrade... 解决方案:或设置该属性,或找到(请!)这个通配符,并替换它们(用更合适的东西)。 non-resolved-duplicate
-
..springfox 还是 springdoc??
标签: spring spring-boot spring-mvc spring-security