Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data REST: Data Meets Hypermedia Greg Turnquist @gregturn [email protected] github.com/gregturn
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 3 Hypermedia is an adventure You only need a few tools But the results can be amazing
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What is Spring Data REST? § Implements common patterns on top of repositories • Collection / Item resources • Association resources • Search resources § Supports • JPA, GemFire, Neo4j, MongoDB, (soon Solr) • Others are coming… 6
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 7 What is Spring Data REST? “What needs to be done to make the REST architectural style clear on the notion that hypertext is a constraint? In other words, if the engine of application state (and hence the API) is not being driven by hypertext, then it cannot be RESTful and cannot be a REST API. Period. Is there some broken manual somewhere that needs to be fixed? Dr. Roy Fielding
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What is Spring Data REST? § Leverages hypermedia & Internet standards • HAL (draft) • ALPS (draft) • URI Templates (RFC 6570) • text/uri-list mediatype (RFC 2483) • profile link relation (RFC 6906) • JSON Patch (RFC 6902) 9 You aren’t building a “Spring Data REST” app, but instead a RESTful standards- based app.
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ HAL 11 Hypertext Application Language A lean hypermedia type application/hal+json Adopting HAL will make your API explorable, and its documentation easily discoverable from within the API itself. — Mike Kelly, HAL spec lead
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Architecture of our demo 14 GET /api Spring-a-Gram MVC SQL Spring Data Spring Mobile Spring Hateoas Spring Framework Spring HATEOAS + Spring MVC + Spring Data = Spring Data REST
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 17 Learn More. Stay Connected. Twitter: twitter.com/springcentral YouTube: spring.io/video LinkedIn: spring.io/linkedin Google Plus: spring.io/gplus