Swagger 적용

@EnableOpenApi 추가

1
2
3
4
5
6
7
8
@EnableOpenApi
@SpringBootApplication
public class AlbaCheckerApplication {

    public static void main(String[] args) {
        SpringApplication.run(AlbaCheckerApplication.class, args);
    }
}

grade 추가

1
2
3
4
5
6
// https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
    implementation 'io.springfox:springfox-swagger-ui:3.0.0'
    // https://mvnrepository.com/artifact/io.springfox/springfox-swagger2
    implementation 'io.springfox:springfox-swagger2:3.0.0'
    // https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter
    implementation 'io.springfox:springfox-boot-starter:3.0.0'

스웨거 설정 파일 추가

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .build()
                .useDefaultResponseMessages(false)
                ;
    }
}

3.0 이상은 http://localhost:8080/swagger-ui/index.html 로 접속한다.