springdoc-openapi: OpenAPI + Springboot - Swagger not available

Describe the bug

the api-doc endpoint is available, but swagger is not accessible with springboot 3.4.0 and springdoc 2.7.0

To Reproduce Steps to reproduce the behavior:

  • What version of spring-boot you are using? 3.4.0
  • What modules and versions of springdoc-openapi are you using? 2.7.0
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
  • Provide with a sample code (HelloController) or Test that reproduces the problem

Expected behavior

Be able to use swagger-ui.html

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>org.examples</groupId>
	<artifactId>rest-controller-openapi</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<properties>
		<maven.compiler.source>21</maven.compiler.source>
		<maven.compiler.target>21</maven.compiler.target>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<version>3.4.0</version>
		</dependency>
  <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>2.7.0</version>
   </dependency>

		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.34</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
			<version>3.4.0</version>
		</dependency>
	</dependencies>

	<build>
		<finalName>rest-controller-openapi</finalName>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 16

Most upvoted comments

I’m using spring “3.4.1” and works, see:

	implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0")
	implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:2.7.0")

properties:

# swagger-ui custom path
springdoc.swagger-ui.path=/swagger-ui.html

Yes, it works:

    <!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui -->
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
        <version>2.7.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui -->
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
        <version>2.7.0</version>
    </dependency>

I’m using spring “3.4.1” and works, see:

	implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0")
	implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:2.7.0")

properties:

# swagger-ui custom path
springdoc.swagger-ui.path=/swagger-ui.html

Same issue with spring boot when upgrade from 3.3.1 to 3.4.1

@socmia, I tried on springboot 3.4.1 and downgrade springdoc to 2.7.0-RC1, able to run as well.

Bumping this, I am having the same issue right after updating Spring Boot 3.4.0 from 3.3.4, and having to upgrade springdoc to 2.7.0. Looking from /actuator/mappings, the swagger endpoint seems unavailable.

image

same issue, spring boot 3.4.0 and openapi 2.0.2

same issue, spring boot 3.4.0

Try adding this dependency org.springdoc springdoc-openapi-starter-webmvc-ui 2.6.0

i got swagger integrated into it

@hiabhi-cpu

The OP has already shown that they have version 2.7.0 installed, downgrading it to 2.6.0 wouldn’t solve the issue since Spring Boot 3.4.0 specifically requires springdoc to be 2.7.0. Let me know if I’m wrong.

Same issue with spring boot 3.4.0 and openapi 2.7.0