Skip to content

Springdoc v2.8.15 path matching build error with Spring Boot v3.4.4 #3210

@the-raj

Description

@the-raj

Describe the bug

Spring Boot version 3.4.4 application does not build/run with springdoc-openapi-starter-webmvc-ui version 2.8.15. It fails with the following error when running mvn clean spring-boot:run:

***************************
APPLICATION FAILED TO START
***************************

Description:

Invalid mapping pattern detected:
/swagger-ui/**/*swagger-initializer.js
           ^
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'.

However, after downgrading to springdoc version 2.8.14, the application runs as expected (NOTE: setting the mentioned property to ant_path_matcher also doesn't work). This seems to be related to #3145

Sample application modules + versions

  • Spring Boot version: 3.4.4
  • Java version: 17
  • Maven version: 3.8.1
  • Springdoc-openapi
    • module: springdoc-openapi-starter-webmvc-ui
    • broken version: 2.8.15
    • working version: 2.8.14

Sample application code

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.demoApp</groupId>
  <artifactId>repro</artifactId>
  <version>1</version>
  <properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
  </properties>
  <dependencyManagement>
    <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-dependencies</artifactId>
      <version>3.4.4</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>2.8.15</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>

App.java

package com.demoapp.repro;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class App {
  public static void main(String[] args) {
    SpringApplication.run(App.class, args);
  }
}

HelloController.java

package com.demoapp.repro;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
  @GetMapping("/hello")
  public String hello() {
    return "Hello, World!";
  }
}

Steps to Reproduce

  1. Copy the above code into a demo folder (i.e. {demoRoot}/pom.xml, {demoRoot}/src/main/java/App.java, and {demoRoot}/src/main/java/HelloController.java)
  2. Run the following terminal command mvn clean spring-boot:run
  3. Check terminal output or navigate to http://localhost:8080/swagger-ui/index.html

To get a working version:

  1. Change the package version in pom.xml to 2.8.14
  2. Run the same mvn clean spring-boot:run command in the terminal
  3. Check terminal output or navigate to http://localhost:8080/swagger-ui/index.html

Expected behavior

  • Application builds and runs without maven build error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions