Exposing link on collection entity in spring data REST

前端 未结 2 1324
执念已碎
执念已碎 2020-12-15 12:40

Using spring data REST I have exposed a ProjectRepository that supports listing projects and performing CRUD operations on them. When I go to http://local

相关标签:
2条回答
  • 2020-12-15 13:00

    I had the same issue. What worked for me was:

    public class ProjectsResourceProcessor implements ResourceProcessor<PagedResources<Resource<Project>>> {
    
        private final @NonNull EntityLinks entityLinks;
    
        @Override
        public PagedResources<Resource<Project>> process(PagedResources<Resource<Project>> pagedResources) {
    
           ...
    
            return pagedResources;
        }
    }
    
    0 讨论(0)
  • 2020-12-15 13:05

    The collection resources render an instance of Resources<Resource<Project>>, not Resource<Collection<Project>>. So if you change the generic typing in your ResourceProcessor implementation accordingly that should work as you expect it.

    0 讨论(0)
提交回复
热议问题