You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using projections with the @Projection annotation in Spring Data REST, the content association in the HATEAOS _links section is missing.
That is because Spring Content looks for fields annotated with @ContentId to generate the link in ContentLinksResourceProcessor.
But projections have no fields, only methods. Putting the @ContentId annotation on a String getContentId() method in the projection interface does not help.
I think this could be resolved by not only considering the fields, but also looking at the propertyDescriptor.getReadMethod() when checking if the @ContentId annotation is present.
Pseudo code:
var propertyDescriptor = new BeanWrapperImpl(object).getPropertyDescriptors()[index];
if (AnnotationUtils.findAnnotation(propertyDescriptor.getReadMethod(), ContentId.class) != null) {
...
}
When using projections with the
@Projection
annotation in Spring Data REST, thecontent
association in the HATEAOS_links
section is missing.That is because Spring Content looks for fields annotated with
@ContentId
to generate the link in ContentLinksResourceProcessor.But projections have no fields, only methods. Putting the
@ContentId
annotation on aString getContentId()
method in the projection interface does not help.I think this could be resolved by not only considering the fields, but also looking at the
propertyDescriptor.getReadMethod()
when checking if the@ContentId
annotation is present.Pseudo code:
@paulcwarren would you consider such a change ?
The text was updated successfully, but these errors were encountered: