'Which version of spring doc open ui gradle plugin be used with spring-boot 2.6?
Which version of spring doc open ui gradle plugin be used with spring-boot 2.6 ? I see this is the last plugin id "org.springdoc.openapi-gradle-plugin" version "1.3.3" which si not compatable with spring-boot 2.6
Solution 1:[1]
I don't use the plugin. So maybe my answer can help you... I just migrated from Spring-Boot 2.5.4 to 2.6.7 and everything now is working properly. I also migrated from SpringFox to OpenApi 3 using the lib org.springdoc:springdoc-openapi-ui:1.6.8
This is the class (kotlin) i used to instruct OpenApi to generate the swagger:
package br.com.rss.config
import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.OpenAPI
import io.swagger.v3.oas.models.info.Contact
import io.swagger.v3.oas.models.info.Info
import io.swagger.v3.oas.models.security.SecurityRequirement
import io.swagger.v3.oas.models.security.SecurityScheme
import org.springdoc.core.GroupedOpenApi
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class OpenApiConfig {
@Bean
fun publicApi(): GroupedOpenApi? {
return GroupedOpenApi.builder()
.group("1. public-apis")
.displayName("Native Services API")
.packagesToScan("br.com.rss.api")
.packagesToExclude("br.com.rss.external.api")
.pathsToMatch("/**")
.pathsToExclude("/actuator/**")
.build()
}
@Bean
fun externalApi(): GroupedOpenApi? {
return GroupedOpenApi.builder()
.group("2. external-apis")
.displayName("External Services API")
.packagesToScan("br.com.rss.external.api")
.packagesToExclude("br.com.rss.api")
.pathsToMatch("/**")
.pathsToExclude("/actuator/**")
.build()
}
@Bean
fun springOpenAPI(): OpenAPI? {
return OpenAPI()
.addSecurityItem(SecurityRequirement().addList("bearerAuth"))
.components(
Components()
.addSecuritySchemes("bearerAuth",
SecurityScheme()
.name("bearerAuth")
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT"))
)
.info(
Info()
.title("Open Services API")
.description("APIs related to backend services")
.contact(Contact().name("Thiago Rodrigues").email("[email protected]"))
)
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | thiagotrss |