2025-07-11 17:39:59.496 WARN [hsm-service,,] 1 --- [hsm-service] [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiDescriptionReader' defined in URL [jar:nested:/app/hsm-service-0.0.1.jar/!BOOT-INF/lib/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/ApiDescriptionReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'cachingOperationReader' defined in URL [jar:nested:/app/hsm-service-0.0.1.jar/!BOOT-INF/lib/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/CachingOperationReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'apiOperationReader' defined in URL [jar:nested:/app/hsm-service-0.0.1.jar/!BOOT-INF/lib/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/readers/operation/ApiOperationReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'documentationPluginsManager': Unsatisfied dependency expressed through field 'documentationPlugins': Error creating bean with name 'documentationPluginRegistry': 'void org.springframework.util.Assert.notNull(java.lang.Object)'
Assistant
The log snippet you've posted shows that your Spring Boot application is failing to start due to bean creation errors related to Springfox (version 2.9.2). Specifically, the failure occurs during ApiDescriptionReader bean initialization because of unsatisfied dependencies cascading down to documentationPluginRegistry and an error involving Assert.notNull().
Key points:
The failure is in Springfox 2.9.2 while creating beans like:
apiDescriptionReader
cachingOperationReader
apiOperationReader
documentationPluginsManager
documentationPluginRegistry
The root cause seems to be an error calling Assert.notNull(Object) from Spring Framework's Assert utility class.
Common root causes and fixes for this issue
1. Incompatible Springfox and Spring Boot versions
Springfox 2.9.2 is quite old and does not support Spring Boot 2.6+ or newer very well. Spring Framework 5.3+ or Spring Boot 2.6+ introduced internal changes that broke parts of Springfox 2.x.
Explanation: Starting from Spring Boot 2.6 and later, Spring MVC path matching changed (introduction of PathPatternParser), and Springfox wasn't updated to support these, resulting in bean initialization failures. Also, later Spring Framework versions changed internals like Assert method signatures or behaviors.
Solution:
Downgrade Spring Boot to 2.5.x or earlier, which is compatible with Springfox 2.9.2.
OR upgrade Springfox to a version compatible with your Spring Boot version (see next point).
2. Upgrade to Springfox 3.x
Springfox 3.0.0 addresses some of the compatibility issues with Spring Boot newer versions, including path pattern changes and Spring 5.3+ compatibility.
This version works better with Spring Boot 2.6 and 2.7+, but be aware there are still some open issues that require workarounds for certain Spring Boot versions.
User
Which version should I use?
Currently I am on Springboot 3.5
Assistant
You're using Spring Boot 3.5 (I assume you meant 3.0.5 or some 3.x version because as of mid-2024, Spring Boot 3.x is the current major line; if you meant 3.5 as a minor version, correct me).
Important compatibility note:
Spring Boot 3.x is based on Spring Framework 6 and requires Java 17+
Springfox does NOT support Spring Boot 3.x / Spring Framework 6 (as of now, including latest released Springfox versions)
Springfox development has stalled and does not support Spring Framework 6 / Spring Boot 3.x.
What does that mean for you?
Springfox 2.9.2 and 3.0.0 do not work with Spring Boot 3.x.
There is no viable Springfox version for Spring Boot 3.x.
Trying to run Springfox dependencies on Spring Boot 3.x causes exactly errors like you posted (bean creation failures, Assert.notNull(...) issues, etc).
Recommended approach:
Switch from Springfox to springdoc-openapi, which fully supports Spring Boot 3.x and Spring Framework 6.
How to migrate to springdoc-openapi?
Replace your existing springfox dependencies with:
xml
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version> <!-- or latest -->
</dependency>
This starter module includes everything needed for OpenAPI 3, Swagger UI, and supports Spring Boot 3.x out of the box.
@Configuration
@EnableSwagger2
@Profile({"local","dev","sit","uat"})
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}
How to convert this?
Assistant
Since you are moving from Springfox (which you used in your SwaggerConfig class) to springdoc-openapi (recommended for Spring Boot 3.x), you don't need to manually define a configuration class like this in most cases.
Key Points:
springdoc-openapi auto-configures everything by default.
You just add the springdoc-openapi dependency, and your API docs are available automatically.
You can still customize the OpenAPI definition using a @Bean of type OpenAPI if needed.
Minimal migration steps for your example:
Remove SwaggerConfig completely.
With springdoc-openapi, you typically do NOT need a bean like Docket because springdoc implements OpenAPI 3 and will scan your controllers automatically.
Add the dependency:
Make sure your pom.xml contains:
xml
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version> <!-- use latest -->
</dependency>
Optional: Customizing the OpenAPI bean in a config class
If you want to explicitly specify scanned packages or customize metadata, create a config like:
java
package com.dbs.dtip.hsm.config;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
@Profile({"local","dev","sit","uat"})
public class OpenAPIConfig {
// Optional: Define group scanning only specific packages or paths
@Bean
public GroupedOpenApi api() {
return GroupedOpenApi.builder()
.group("api")
.packagesToScan("com.dbs.dtip.hsm.controller") // restrict package scanning if needed
.build();
}
// Optional: API info (title, description)
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.info(new Info()
.title("HSM Service API")
.version("1.0")
.description("API documentation for HSM Service"));
}
}
User
I try to delete entire swagger config, but have this issue
Cannot find Symbol
code
@ApiOperation(value="post call with sca or other identifier to generate key and address", response = EthKeyGenerateResponse.class)
@ApiResponses(value = {
@ApiResponse(code=200, message="Successfully generate key and address"),
@ApiResponse(code=503, message="Temporarily unavailable")
})
Assistant
The error Cannot find symbol on annotations like @ApiOperation, @ApiResponses, and @ApiResponse occurs because these annotations are from Swagger 2 (springfox) packages that you removed when deleting the SwaggerConfig and its springfox dependencies.
Why?
@ApiOperation and @ApiResponse are springfox annotations, part of these packages:
Do I need both:
io.swagger.core.v3 and org.springdoc?
Assistant
Good question!
Short answer:
You only need the springdoc-openapi dependency in your project. You do NOT usually need to explicitly add io.swagger.core.v3 (swagger-annotations) unless you want to use the annotations outside the context of springdoc.
Explanation:
springdoc-openapidepends transitively on io.swagger.core.v3:swagger-annotations.
This means when you add springdoc-openapi starter in your pom.xml (or Gradle), it automatically brings the OpenAPI 3 annotations like @Operation, @ApiResponse, etc. into your classpath.
So you can use these annotations immediately without manually adding swagger-annotations.
Example Maven dependency:
xml
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version> <!-- latest version -->
</dependency>
This gives you:
The auto-configuration of OpenAPI 3 docs for Spring Boot.
Swagger UI.
All the necessary annotations (swagger-core included transitively).
When might you need io.swagger.core.v3:swagger-annotations explicitly?
If you want to use the OpenAPI annotations without springdoc (rare).
If your build or project setup excludes transitive dependencies somehow.
Or you want to use a different version explicitly.
Summary:
Dependency
Purpose
Needed when using springdoc?
org.springdoc:springdoc-openapi-starter-webmvc-ui
Springdoc OpenAPI with Swagger UI for Spring Boot 3.x
If you want, I can show you a minimal pom.xml snippet with the right dependencies.
User
Please show me a minimal pom.xml snippet with the right dependencies.
Assistant
Certainly! Here's a minimal pom.xml snippet for a Spring Boot 3.x project using springdoc-openapi with Swagger UI, including the essential dependencies and plugin for building the jar:
xml
<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>com.example</groupId>
<artifactId>hsm-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<java.version>17</java.version>
<spring.boot.version>3.0.5</spring.boot.version> <!-- adjust as appropriate -->
<springdoc.version>2.1.0</springdoc.version> <!-- latest springdoc version -->
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Spring Boot Starter Web (REST controllers, etc) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Springdoc OpenAPI Starter for Spring Web MVC with Swagger UI -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- Optional: If you use validation annotations and want them reflected in OpenAPI -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-validation</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- Optional: Lombok -->
<!-- <dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency> -->
<!-- Testing (optional) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Spring Boot Maven Plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
</plugin>
</plugins>
</build>
</project>
User
Will this work for:
code
@ApiOperation(value="post call with sca or other identifier to generate key and address", response = EthKeyGenerateResponse.class)
@ApiResponses(value = {
@ApiResponse(code=200, message="Successfully generate key and address"),
@ApiResponse(code=503, message="Temporarily unavailable")
})
Assistant
No, those @ApiOperation and @ApiResponses/@ApiResponse annotations are from Springfox (Swagger 2) and won't work with the springdoc-openapi dependency alone, because:
springdoc-openapi uses the OpenAPI 3 annotations from package io.swagger.v3.oas.annotations.
The springfox annotations (io.swagger.annotations) are not included in springdoc-openapi.
If you have removed springfox dependencies, these annotations will cause compile errors ("Cannot find symbol").
What you need to do:
Replace springfox annotations with the OpenAPI 3 equivalents:
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Operation(
summary = "post call with sca or other identifier to generate key and address",
responses = {
@ApiResponse(responseCode = "200", description = "Successfully generate key and address"),
@ApiResponse(responseCode = "503", description = "Temporarily unavailable")
}
)
@PostMapping("/generateKey")
public EthKeyGenerateResponse generateKey(SampleRequest request) {
// your business logic
}
Note:
response = EthKeyGenerateResponse.class is inferred by springdoc/OpenAPI from your method return type, so you generally don’t need to specify it in @Operation.
If you want to override or specify schema explicitly, there's a way, but typically this is automatic.
Summary
Use springdoc-openapi dependencies from my previous message.
Remove all springfox dependencies.
Migrate all @ApiOperation, @ApiResponses, @ApiResponse imports and usage to the corresponding io.swagger.v3.oas.annotations.* annotations.
After this, your code will compile and your API docs will be generated properly.
If you want, I can help convert your entire controller or multiple annotations!
User
@ApiOperation(value="post call with sca or other identifier to generate key and address", response = EthKeyGenerateResponse.class)
@ApiResponses(value = {
@ApiResponse(code=200, message="Successfully generate key and address"),
@ApiResponse(code=503, message="Temporarily unavailable")
})
Ok help me convert this
Assistant
Certainly! Here is the converted version using OpenAPI 3 annotations (io.swagger.v3.oas.annotations) which work with springdoc-openapi:
java
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
// ...
@Operation(
summary = "post call with sca or other identifier to generate key and address"
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully generate key and address"),
@ApiResponse(responseCode = "503", description = "Temporarily unavailable")
})
public EthKeyGenerateResponse yourMethodName(/* your params here */) {
// method implementation
}
The response = EthKeyGenerateResponse.class is not needed because springdoc automatically infers the response schema from the method return type.
@ApiResponses with nested @ApiResponse replace the old messages, but now you use responseCode = "200" (string) instead of code = 200 (int).
The description attribute replaces message.
Full snippet example:
java
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class YourController {
@Operation(summary = "post call with sca or other identifier to generate key and address")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully generate key and address"),
@ApiResponse(responseCode = "503", description = "Temporarily unavailable")
})
@PostMapping("/generateKey")
public EthKeyGenerateResponse generateKey(SampleRequest request) {
// your code here
}
}
Let me know if you want help converting more annotations or full controllers!
User
import io.swagger.v3.oas.annotations.*;
Is this correct?
I still cannot resolve the symbol
Assistant
The import statement you wrote:
java
import io.swagger.v3.oas.annotations.*;
is syntactically correct in Java for importing all classes and interfaces in the io.swagger.v3.oas.annotations package.
But to resolve the symbol, you need:
Make sure you have the dependency that provides these classes.
For the OpenAPI 3 annotations, the Maven dependency that contains the package io.swagger.v3.oas.annotations is:
xml
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.10</version> <!-- or a recent version -->
</dependency>
However, if you include springdoc-openapi starter dependency (recommended), it already pulls this transitively. For example:
Minimal working Pom.xml snippet that ensures availability of these annotations
xml
User
@Api
Is this still valid?
Assistant
The @Api annotation you are referring to is from Springfox / Swagger 2:
java
import io.swagger.annotations.Api;
Is it still valid with springdoc-openapi / OpenAPI 3?
No, @Api is NOT used or recognized by springdoc-openapi. It belongs to the older springfox ecosystem which is incompatible with Spring Boot 3.x and Spring Framework 6.
What is the alternative?
springdoc-openapi primarily relies on standard Spring MVC annotations for detecting and documenting API endpoints (e.g., @RestController, @RequestMapping, @GetMapping, etc.).
For grouping or adding metadata to your APIs, springdoc uses OpenAPI 3 annotations, but there is no direct 1:1 replacement for @Api annotation.
If you want to describe/tag your APIs:
Use the OpenAPI 3 @Tag annotation:
java
import io.swagger.v3.oas.annotations.tags.Tag;
@Tag(name = "Your API", description = "Description of your API group")
@RestController
public class YourController {
// ...
}
This is typically used to group operations in Swagger UI.
Summary:
Old annotation
New OpenAPI 3 approach
@Api (from springfox)
Use @Tag, or rely on Spring MVC annotations
Springdoc automatically documents controllers/endpoints based on bean/class info
What to do with existing @Api annotations?
Simply remove them.
Use @Tag if you want to add grouping or description to your controller APIs.
Otherwise, springdoc will detect all RestControllers automatically.
If you want, I can show you how to migrate your controller classes using @Tag.
If you want help with other model classes or usage examples, just ask!
User
@Operation(value="post call with sca or other identifier to generate key and address", response = EthKeyGenerateResponse.class)
@ApiResponses(value = {
@ApiResponse(code=200, message="Successfully generate key and address"),
@ApiResponse(code=503, message="Temporarily unavailable")
})
Is this still correct?
Seem like value and code are not valid anymore?
Assistant
Correct — those annotations and their properties are outdated or incorrect for OpenAPI 3 / springdoc.
If you want I can help you refactor your entire set of annotations!
User
help me convert this:
@Operation(value="post call with sca or other identifier to derive key and address", response = EthKeyGenerateResponse.class)
@ApiResponses(value = {
@ApiResponse(code=200, message="Successfully derive key and address"),
@ApiResponse(code=503, message="Temporarily unavailable")
})
Assistant
Here's the converted version using OpenAPI 3 annotations (io.swagger.v3.oas.annotations) that are compatible with springdoc-openapi:
java
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
@Operation(summary = "post call with sca or other identifier to derive key and address")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "Successfully derive key and address"),
@ApiResponse(responseCode = "503", description = "Temporarily unavailable")
})
public EthKeyGenerateResponse yourMethodName(/* params here */) {
// method implementation
}
Notes:
value → replaced by summary.
response attribute removed because the method return type EthKeyGenerateResponse is used automatically.
code → responseCode (as String).
message → description.
@ApiResponses can be used with array initializer { ... } or with ({ ... }).
If you want, I can provide a fully fleshed out example with Spring annotations and method signature.
Not yet included in a published release.
3. Switch to springdoc-openapi as an alternative
Since Springfox development has stalled for a while and some issues remain with latest Spring Boot, many users switch to springdoc-openapi, which is more actively maintained and supports OpenAPI 3:
Add dependency:
xml
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.8.0</version> <!-- or latest available -->
</dependency>
It is mostly configuration-free and works well with modern Spring Boot versions.
Recap / Action plan
Check your Spring Boot version.
If 2.6 or later and you want to keep Springfox 2.9.2 -> downgrade Spring Boot to 2.5.x.
If you want to keep newer Spring Boot (recommended), upgrade Springfox to 3.0.0 or migrate to springdoc-openapi.
Clean build your project (mvn clean install or ./gradlew clean build) after changes.
Test application startup.
If you want more specific guidance, please share your:
pom.xml (or build.gradle) dependencies
Spring Boot version
A minimal snippet of your Spring configuration related to Swagger/Springfox.
Summary:
The error you face is a known incompatibility between Springfox 2.9.2 and newer Spring Boot / Spring Framework versions leading to bean creation failures. Upgrading Springfox to 3.0.0 or switching to springdoc-openapi is the recommended fix.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version> <!-- use latest version from Maven Central -->
</dependency>
Your OpenAPI/Swagger UI will be available by default at: http://localhost:8080/swagger-ui.html or http://localhost:8080/swagger-ui/index.html
(Optional) Customize by adding an OpenAPI config bean following the springdoc docs.
Spring Boot 3.x migration - Springdoc is officially recommended for generating API docs.
Summary:
Spring Boot version
Recommended Swagger solution
Before 3.0
Springfox 3.0.0 (if possible)
3.x (Spring Framework 6)
springdoc-openapi only (Springfox incompatible)
If you want me to help rewrite your Swagger config using springdoc-openapi or have more questions, just ask!
How to access the docs now?
Open your browser at:
code
http://localhost:8080/swagger-ui/index.html
OpenAPI JSON:
code
http://localhost:8080/v3/api-docs
Summary:
Springfox config
springdoc-openapi changes
@EnableSwagger2
Remove, not needed with springdoc
Docket bean
Replace with optional GroupedOpenApi bean or nothing
Packages scanned
Config via .packagesToScan() or default all controllers
Access URL
/swagger-ui/index.html (instead of old /swagger-ui.html)
If you want me to generate an example with your exact controller packages, just provide the base package names.
Feel free to ask if you want help migrating more configs!
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ApiResponse;
@ApiOperation(value="post call with sca or other identifier to generate key and address", response = EthKeyGenerateResponse.class)
@ApiResponses(value = {
@ApiResponse(code=200, message="Successfully generate key and address"),
@ApiResponse(code=503, message="Temporarily unavailable")
})
@PostMapping("/generateKey")
public EthKeyGenerateResponse generateKey(SampleRequest request) {
// ...
}
Migrated to springdoc/OpenAPI 3:
java
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Operation(summary = "post call with sca or other identifier to generate key and address",
responses = {
@ApiResponse(responseCode = "200", description = "Successfully generate key and address"),
@ApiResponse(responseCode = "503", description = "Temporarily unavailable")
})
@PostMapping("/generateKey")
public EthKeyGenerateResponse generateKey(SampleRequest request) {
// ...
}
Additional notes:
The response attribute in springfox’s @ApiOperation is replaced by describing responses with @ApiResponse and by relying on method return types.
If you want, you can add content specification inside @ApiResponse to describe the response schema further (optional).
What Maven/Gradle dependency do you need for these annotations?
Add this swagger-core dependency, which springdoc uses for annotations:
xml
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.10</version> <!-- or latest -->
</dependency>
Note: springdoc-openapi starters already include this dependency transitively, so usually you do not need to add it manually unless you want the annotations independently in your compile scope.
If you want, I can provide a small script or full example to convert your existing annotations.
Bottom line: After switching to springdoc-openapi, replace springfox annotations with OpenAPI 3 annotations from io.swagger.v3.oas.annotations package to fix your compilation issues.
Explanation:
spring-boot-starter-web — basic Spring Web stack, controllers etc.
springdoc-openapi-starter-webmvc-ui — springdoc with embedded Swagger UI, auto-configuration included.
Optional starter springdoc-openapi-starter-validation is useful if you want bean validation annotations (@Valid, @NotNull, etc.) to be considered by OpenAPI.
Java version set to 17, which is required for Spring Boot 3.x and Spring Framework 6.x.
Adjust versions as necessary but keep Spring Boot 3.x and springdoc 2.x compatible.
Once you have this:
Start your Spring Boot app.
Open browser to: http://localhost:8080/swagger-ui/index.html
(or /swagger-ui.html redirects here)
Let me know if you want Gradle equivalent or help with migrating code as well!
<dependencies>
<!-- Spring Boot Starter Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Springdoc OpenAPI with Swagger UI (includes swagger-annotations transitively) -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
Troubleshooting tips:
If you explicitly added only springdoc dependency (as above), but still can’t resolve, verify Maven dependencies in your IDE or run mvn dependency:tree to check if io.swagger.core.v3:swagger-annotations is present.
If not present, you can add swagger-annotations dependency explicitly as: