• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    해결됨

스프링부트 2.2 이상에서 Resource, PagedResource 관련 변경 사항

21.02.24 12:50 작성 조회수 250

2

출처:

https://stackoverflow.com/questions/25352764/hateoas-methods-not-found

83
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" data-controller="s-tooltip" data-s-tooltip-placement="right" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-theme-primary" aria-describedby="--stacks-s-tooltip-aimxplvy" style="margin:2px;box-sizing:inherit;font:unset;position:relative;padding:0px;border-radius:0px;background-image:none;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;outline:none;user-select:auto;box-shadow:none;border:initial none initial"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg" width="36" height="36" viewbox="0 0 36 36"><path d="M2 10h32L18 26 2 10z"></path></svg></button>

In case you are using HATEOAS v1.0 and above (Spring boot >= 2.2.0), do note that the classnames have changed. Notably the below classes have been renamed:

  • ResourceSupport changed to RepresentationModel
  • Resource changed to EntityModel
  • Resources changed to CollectionModel
  • PagedResources changed to PagedModel
  • ResourceAssembler changed to RepresentationModelAssembler

More information available in the official documentation here.

When using Spring boot starter, the below dependency would suffice to include HATEOAS:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>

Hoping this information will help someone like me who searched for hours to find why Resource class was not getting resolved.

스프링부트 버전 2.2 이상 이신분들은 참고하시면 될거 같아요~

답변 2

·

답변을 작성해보세요.

0

OMG님의 프로필

OMG

질문자

2021.03.15

0

정리 해주셔서 감사합니다.