본문 바로가기
IT/java

Spring boot + Swagger 3.0

by 허브큐 2021. 4. 13.

  • dependency 추가 (gradle 기준)
dependencies {
    ...

    implementation 
"io.springfox:springfox-boot-starter:3.0.0"
    compile 'io.springfox:springfox-swagger-ui:3.0.0'

}

 

  • 설정파일 추가 (SwaggerConfig.java)
@Configuration
public class SwaggerConfig {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.OAS_30) // open api spec 3.0
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build();
    }
}

 

  • 검증
    • http://localhost:8080/swagger-ui/index.html

'IT > java' 카테고리의 다른 글

Lombok annotation 정리  (0) 2021.10.21
eclipse에서 svn offline 설치하기  (0) 2020.04.28
Spring Boot study  메모  (0) 2019.02.27
Restful API  (0) 2017.12.23

댓글