I’m migrating from zuul gateway to Spring Cloud Gateway MVC.
But I knew that no more patterns like “/foo//bar/” is allowed since ant_path_mathcer is deprecated.
And I want to keep ant_path_matcher on my Spring Cloud Gateway MVC application.
How can I make it?
I already tried applying “spring.mvc.pathmatch.matching-strategy=ant_path_matcher”,
and also tried
@Configuration
public class PathMatcherConfig implements WebMvcConfigurer {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
AntPathMatcher matcher = new AntPathMatcher();
matcher.setCaseSensitive(false);
configurer.setPathMatcher(matcher);
}
@Bean
public AntPathMatcher antPathMatcher() {
return new AntPathMatcher();
}
}
this configuration code, but both way didn’t worked.
Here’s the error log.
APPLICATION FAILED TO START
Description:
Invalid mapping pattern detected:
/foo//bar/
^
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’.