작성
·
495
1
안녕하세요 강의 잘듣고있습니다.
앞에 강의에서 어떤분이 heteoas 버전이 변경되면서 바뀐부분이 있다고 알려주셔서 ResourceSupport대신 RepresentationModel 사용해서 따라하고 있었는데요.
assembler 에서 toResource 대신 toModel로 바뀌었다는 것까지는 알았습니다.
Consequently, ResourceAssembler
has been renamed to RepresentationModelAssembler
and its methods toResource(…)
and toResources(…)
have been renamed to toModel(…)
and toCollectionModel(…)
respectively. Also the name changes have been reflected in the classes contained in TypeReferences
.
@GetMapping
public ResponseEntity queryEvents(Pageable pageable, PagedResourcesAssembler<Event> assembler){
Page<Event> page = this.eventRepository.findAll(pageable);
var resource = assembler.toModel(page, e-> new EventResource(e));
return ResponseEntity.ok(resource);
}
그런데 위와같이 하면
Error:(66, 48) java: incompatible types: cannot infer functional interface descriptor for org.springframework.hateoas.server.RepresentationModelAssembler<com.hong.springrestapi.events.Event,org.springframework.hateoas.RepresentationModel>
이렇게 에러가 나는데 어떻게 해야할까요?