1. 의존성 추가
Gradle사용할 경우
dependencies {
implementation "io.springfox:springfox-boot-starter:3.0.0"
}
Maven사용할 경우
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
2. 설정
@EnableSwagger2어노테이션 사용하지 않아도 됨
@Configuration
public class SpringFoxConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("This is Title")
.version("1.0")
.description("Blah Blah")
.license("라이센스울라불라")
.build();
}
}
원래 http://localhost/swagger-ui.html로 접속했었는데, http://localhost/swagger-ui/로 바뀌었다고 한다...
계속 404에러 떴는데... 이게 문제였음.... 폰트 크기 63pt로 써놓지 좀...
+)공식문서
Springfox Reference Documentation
The Springfox suite of java libraries are all about automating the generation of machine and human readable specifications for JSON APIs written using the spring family of projects. Springfox works by examining an application, once, at runtime to infer API
springfox.github.io
'STUDY > Spring' 카테고리의 다른 글
Spring Boot | Spring Security OAuth2 (2) grant_type password, postman / Curl로 테스트 (0) | 2021.03.09 |
---|---|
Spring Boot | Spring Security OAuth2 (1) 설정 및 테스트 (inMemory) (0) | 2021.03.08 |
Spring Boot | MyBatis 연동 (0) | 2021.03.04 |
Spring Boot | REST API 만들기 ( + IntelliJ Lombok추가) (0) | 2021.03.04 |
Spring Boot | S3 Pre-Signed URL 생성 (0) | 2021.01.28 |