官术网_书友最值得收藏!

How it works...

As is evidenced from the browser view, we will get significantly more information than we got when we wrote the books controller. This is in part due to us extending not a CrudRepository interface, but a PagingAndSortingRepository one, which in turn is an extension of CrudRepository. The reason that we've decided to do this is to get the extra benefits provided by PagingAndSortingRepository. This will add the extra functionality to retrieve entities using the pagination and being able to sort them.

The @RepositoryRestResource annotation, while optional, provides us with the ability to have finer control over the exposure of the repository as a web data service. For example, if we wanted to change the URL path or rel value, to writers instead of authors, we could have tuned the annotation as follows:

@RepositoryRestResource(collectionResourceRel = "writers", path = "writers") 

As we included spring-boot-starter-data-rest in our build dependencies, we will also get the spring-hateoas library support, which gives us nice ALPS metadata, such as a _links object. This can be very helpful when building an API-driven UI, which can deduce the navigational capabilities from the metadata and present them appropriately.

主站蜘蛛池模板: 福州市| 滕州市| 沅江市| 青岛市| 平陆县| 雅江县| 鄂托克旗| 垫江县| 玉林市| 陈巴尔虎旗| 九江县| 偃师市| 荔波县| 鄯善县| 虞城县| 中卫市| 浠水县| 双流县| 莎车县| 石楼县| 家居| 天全县| 赤峰市| 左权县| 商城县| 彭泽县| 山西省| 广宁县| 泰宁县| 玛沁县| 仙居县| 定西市| 瑞安市| 宣威市| 尚义县| 黄陵县| 新巴尔虎左旗| 宜黄县| 岳普湖县| 秦皇岛市| 阳高县|