-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
스프링 hateoas를 책과 다른 변경사항
ResourceSupportchanged toRepresentationModelResourcechanged toEntityModelResourceschanged toCollectionModelPagedResourceschanged toPagedModelResourceAssemblerchanged toRepresentationModelAssemblerControllerLinkBuilderchanged toWebMvcLinkBuilderResourceProcessorchanged toRepresentationModelProcessor
springframework에서의 hateoas가 위와 같이 변경되었습니다. 이를 고려해서 책을 보시면 됩니다!
예를 들어 책 213쪽의리스트 6.4 리소스에 하이퍼링크 추가하기를 이런식으로 변경하면 됩니다
@GetMapping("/recent")
public CollectionModel<EntityModel<Taco>> recentTacos(){
PageRequest page=PageRequest.of(0, 12,Sort.by("createdAt").descending());
List<Taco> tacos=tacoRepo.findAll(page).getContent();
CollectionModel<EntityModel<Taco>> recentResources=CollectionModel.wrap(tacos);
recentResources.add(new Link("http://localhost:8080/design/recent","recents"));
return recentResources;
}
p.s. spring 최신버젼으로 직접 코딩하시는분만...
wisehero
Metadata
Metadata
Assignees
Labels
No labels