Getting following error while migrating Spring boot version from 2.1.6 to Spring boot 2.4

Viewed 9853

Getting following error while migrating my project from Spring boot version 2.1.6 to 2.4

No more pattern data allowed after {*...} or ** pattern element

Code Snippet where error is coming

public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**/test/**")
    }
}

I know Spring boot disable AntPathMatcher in version 2.4 , so I tried this option as well

Spring.mvc.pathpattern.matching-strategy= ant_path_matcher

but even this is not working

Any help is much appreciated

4 Answers

With the newest version 1.5.12 of springdoc-openapi-ui the problem is solved for me.

the reason: The error is a path wildcard problem. The search found that the path wildcard has changed after the spring upgrade to 5.3. The official explanation is "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.".

solve: The specific solution is to change /**/*.css to /*/*.css. Multiple files may be involved in the project, and they must be changed.

Set this in your application.properties. Either that or just edit the patterns.

spring.mvc.pathmatch.matching-strategy=ant_path_matcher

Related