Another way some one might help in Spring Boot 3 is way of adding these two dependencies
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0")
implementation 'io.swagger.core.v3:swagger-annotations:2.2.15'
make sure to exclude it from other SDKs if its referencing.