, пожалуйста, найдите ниже следующие два документа:
PFE:
@Document
public class Pfe implements Serializable{
private static final long serialVersionUID = 1L;
@Id
private String id;
private String titre;
private String nomComplet;
private Date dateSoutnance;
private String encadrent;
private String departement;
private String universite;
@DBRef
private Collection<Auteur>auteurs=new ArrayList<Auteur>();
}
и Автор
@Document
public class Auteur implements Serializable{
private static final long serialVersionUID = 1L;
@Id
private String id;
private String nom;
private String prenom;
private String email;
@DBRef
private Pfe pfe;
}
Оба документа имеют @RepositoryRestResrouce
, и когда я пытаюсь отправить pfe с клиентом angular, с примером тела (json) ниже:
{ titre: "aaa",
nomComplet: "aaa",
dateSoutnance: "2020-04-04",
encadrent: "aa",
departement: "aaa",
universite: "aaa",
auteurs:[{
nom: "aaa",
prenom: "aa",
email: "aa",
},{
nom: "ss",
prenom: "ss",
email: "ss",
}]
}
У меня внутренняя ошибка сервера:
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Failed to convert from type [java.net.URI] to type [com.yaacoub.entities.Auteur] for value 'nom'; nested exception is java.lang.IllegalArgumentException: Cannot resolve URI nom. Is it local or remote? Only local URIs are resolvable.; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Failed to convert from type [java.net.URI] to type [com.yaacoub.entities.Auteur] for value 'nom'; nested exception is java.lang.IllegalArgumentException: Cannot resolve URI nom. Is it local or remote? Only local URIs are resolvable. (through reference chain: com.yaacoub.entities.Pfe["auteurs"]->java.util.LinkedHashSet[1])
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:245) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.spcom.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286) ~[jackson-databind-2.10.2.jar:2.10.2]
... 62 common frames omitted
Caused by: java.lang.IllegalArgumentException: Cannot resolve URI nom. Is it local or remote? Only local URIs are resolvable.
... 65 common frames omitted