inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

yonhasky님의 게시글

yonhasky yonhasky

@yonhasky2925

수강평 작성수
-
평균평점
-

게시글 1

질문&답변

Resource HateOAS

버전문제로 이전강의 때 수정했던 내용 참조하여 아래와 같이 만들었습니다. @GetMapping("/users/{id}") public EntityModel retrieveUser(@PathVariable int id) { Optional user = userRepository.findById(id); if (!user.isPresent()) { throw new UserNotFoundException(String.format("ID[%s] not found", id)); } EntityModel model = EntityModel.of(user.get()); WebMvcLinkBuilder linkTo = WebMvcLinkBuilder.linkTo(WebMvcLinkBuilder.methodOn(this.getClass()).retrieveAllUsers()); model.add(linkTo.withRel("all-users")); return model; }

좋아요수
1
댓글수
3
조회수
414