📕 INDEX

Spring Data REST + HAL Explorer 디펜던시 추가

API 를 간편하게 만들기 위해 스프링 부트에 기능을 추가.

implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.data:spring-data-rest-hal-explorer'

⇒ spring data rest

https://spring.io/projects/spring-data-rest

data rest 설정

게시글, 댓글의 json api를 자동으로 restful 하게 만들게끔 설정.

⇒ @RepositoryRestResource annotation 붙여줌.

data.rest:
    base-path: /api
    detection-strategy: annotated
import com.example.projectboard.domain.Article;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

@RepositoryRestResource
public interface ArticleRepository extends JpaRepository<Article, Long> {
}