Skip to content

Compatibility with new PathMatcher #965

Closed
@MatsLP

Description

@MatsLP

Hello,

We are facing a problem when we try to use org.springdoc:springdoc-openapi-ui and enable the new PathMatcher in our webmvc application. The new PathMatcher is available for webmvc since spring-boot 2.4.0 and is intended to replace the AntMatcher.

When we add the WebMvcConfigurer that I appended at the end, we get an error that says:

Invalid mapping pattern detected: /**/swagger-ui/**
^
No more pattern data allowed after {*...} or ** pattern element

I think this might be related to an incompatibility that the spring-team mentions here: https://spring.io/blog/2020/06/30/url-matching-with-pathpattern-in-spring-mvc
Is springdocs compatible with mvc-applications that want to use the new PathPatter, or is this feature planned?

Kind regards and thank you for your work

Additional context

import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.method.HandlerTypePredicate;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.util.pattern.PathPatternParser;

@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer
                .setPatternParser(new PathPatternParser())
                .addPathPrefix("", HandlerTypePredicate.forAnnotation(RestController.class));
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions