0

I cannot get why spring create the same links for self and rel? Is there a way how to disable it? I think that this only my issue because I didn't meet such problem in docs I read.

enter image description here

Here is my entity mapping:

@Getter
@Setter
@Document
public class Ad {
    @Id
    private String id;
    private String description;
    private Banner banner;
}

@Getter
@Setter
public class Banner {
    private String id;
    private String filename;
}

Here is my repository:

@RepositoryRestResource
public interface AdRepository extends CrudRepository<Ad, String> {
}

I touch the following url: http://localhost:8558/ads

I don't use any projections. My app is quite primitive now. There is nothing specific.

Thanks in advance!

slesh
  • 1,902
  • 1
  • 18
  • 29

2 Answers2

0

My only guess is that maybe you're missing hashCode/equals and that's causing a problem

szxnyc
  • 2,495
  • 5
  • 35
  • 46
0

This is by design. The rel-based link allows you to see all contexts, while self link serves as the canonical link.

To further clarify, adjust your repository definition to extend not CrudRepository, but instead PagingAndSortingRepository. The two links rendered for each aggregate root will immediately look slightly different due to extended templating options.

gregturn
  • 2,625
  • 3
  • 25
  • 40