728x90
# build.gradle
implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'io.springfox:springfox-swagger-ui:3.0.0'
# application.yml
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
# SwaggerConfig.java
@Configuration
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.OAS_30)
.useDefaultResponseMessages(true)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.alpaca.postit.post"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
// Swagger UI 에 출력될 API 내용
return new ApiInfoBuilder()
.title("Swagger Test")
.description("SwaggerConfig")
.version("3.0")
.build();
}
}
# Swagger UI
- get
- post
반응형