4
우리는 toResource 메소드를 사용하여 객체를 리소스로 변환하고 다시 (클라이언트에서 서버로 리소스 표현을 게시하는) 표현을 어떻게 도메인 객체로 다시 변환 할 수 있습니까?Spring HATEOAS resourcesupport -> domain 객체
BookResource (extends ResourceSupport) 클래스에서 Book (@Entity) 클래스를 생성하려고합니다.
@RequestMapping(path="/", method = RequestMethod.POST, produces="application/vnd.company.app.book-v1+hal+json")
public ResponseEntity<?> addBook(@RequestBody BookResource bookResource) {
//What to do here?
}
스프링 문서는 ResourceSupport를 확장하는 예제를 제공합니까? http : //docs.spring.io/autorepo/docs/spring-hateoas/0.20.x/reference/html/#fundamentals.resources – EralpB
'Resource'는 'ResourceSupport'이므로,'Resource'를 확장하면 ResourceSupport를 확장하고 요청한 도메인 객체에 액세스 할 수 있습니다. –