Calling spring data rest repository method doesn't return links

后端 未结 2 1592

I have the repository \"ClientRepository\":

public interface ClientRepository extends PagingAndSortingRepository {
}

When i

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-22 03:09

    The HATEOAS functionality is available out of the box only for the Spring data jpa repositories annotated with @RepositoryRestResource. That automatically exposes the rest endpoint and adds the links.

    When you use the repository in the controller you just get the object and the jackson mapper maps it to json.

    If you want to add links when using Spring MVC controllers take a look here

提交回复
热议问题