swagger
-
[RESTFUL 학습] SWAGGER 심화-1SPRING/WEBSERVICE 2020. 8. 31. 00:26
@Configuration @EnableSwagger2 public class SwaggerConfig { private static final Contact DEFAULT_CONTACT = new Contact("Lee","http://www.jump.com","bins@naver.com"); private static final ApiInfo DEFAULT_API_INFO = new ApiInfo("AweSome API Title","rest api study","1.0", "urn:tos",DEFAULT_CONTACT, "Apache 2.0","http://www.apace.org", new ArrayList()); private static final Set DEFAULT_PRODUCTS_AND_..
-
[RESTFUL 학습] SWAGGERSPRING/WEBSERVICE 2020. 8. 23. 22:50
Swagger를 적용함으로써 API를 빠르게 문서화하고 명세할 수 있다. /swagger-ui.html Swagger를 적용 후 위와 같은 URL에 접속하면, 아래 스크린샷과 같이 생성된 API 문서를 볼 수 있다. Swagger를 사용하는 방법은 아래와 같다. 우선 pom.xml에 swagger 라이브러리를 등록한다. io.springfox springfox-swagger2 2.9.2 io.springfox springfox-swagger-ui 2.9.2 그리고 아래와 같이 Configuration(설정파일)을 생성하고 아래와 같이 작성한다. 아래 discover 메서드는 Swagger와 Hateoas를 동시에 적용했을 때 에러가 발생하기 때문에 넣은 소스이다. Haeoas와 Swagger를 동시에 적..