Open dongwooklee96 opened 3 years ago
pom.xml
파일에 의존성 파일을 추가해준다.package com.example.restfulwebservice.config;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configurable
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2);
}
}
그리고 나서 다음과 같은 주소로 접속하면 스웨거 도큐먼트 화면이 출력 된다.
pom.xml
파일에 아래와 같은 내용을 추가한다.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.4.5</version>
</dependency>
http://localhost:8088/acturator 위의 링크에 접속하면 아래와 같은 화면을 볼 수 있다.
Level3 단계의 REST API 구현을 위한 HATEOAS 적용
HATEOAS
를 사용하려면,pom.xml
파일에 아래와 같은 정보를 입력한다.import
문을static
으로 하게 되면 아래와 같이 줄일 수 있다.API
를 사용하는 사용자 입장에서는 편리하게 사용할 수 있다.