dependencies {
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.4.0'
}
다음과 같은 화면이 나오면 제대로 적용한 것이다.
# springdoc-openapi
springdoc.swagger-ui.path=/api-docs
package com.chan.ssb;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.components(new Components())
.info(apiInfo());
}
private Info apiInfo() {
return new Info()
.title("API Test") // API의 제목
.description("Let's practice Swagger UI") // API에 대한 설명
.version("1.0.0"); // API의 버전
}
}
다음과 같이 적용할 수 있다.