Bonjour, je développe une application avec Spring boot
j'essaye d'envoyer une requête post depuis l'application ARC mais je me heurte à une erreur 415 Unsupported Media Type
voici mon controlleur
voici mon entité Client
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 @RestController public class ClientRestService { @Autowired ClientMetier clientMetier; @RequestMapping(value="/clients",method=RequestMethod.POST ,consumes = "application/json") public Client saveClient( @RequestBody Client c) { return clientMetier.saveClient(c); }
voici mon entité Emprunter
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 public class Client implements Serializable{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; private String nom; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public String getPrenom() { return prenom; } public void setPrenom(String prenom) { this.prenom = prenom; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getFiliere() { return filiere; } public void setFiliere(String filiere) { this.filiere = filiere; } public Date getDateEnregistrement() { return dateEnregistrement; } public void setDateEnregistrement(Date dateEnregistrement) { this.dateEnregistrement = dateEnregistrement; } @JsonManagedReference public Set<Emprunter> getEmprunter() { return emprunter; } public void setEmprunter(Set<Emprunter> emprunter) { this.emprunter = emprunter; } private String prenom; private String email; private String filiere; private Date dateEnregistrement; @OneToMany(mappedBy="client") private Set<Emprunter> emprunter= new HashSet<>(); }
aider moi a trouver une solution svp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 public class Emprunter implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long idEmprunt; private Date dateDebutEmprunt; private Date dateDeRetourLivre; private Date dateFinEmprunt; public Long getIdEmprunt() { return idEmprunt; } public void setIdEmprunt(Long idEmprunt) { this.idEmprunt = idEmprunt; } public Date getDateDebutEmprunt() { return dateDebutEmprunt; } public void setDateDebutEmprunt(Date dateDebutEmprunt) { this.dateDebutEmprunt = dateDebutEmprunt; } public Date getDateDeRetourLivre() { return dateDeRetourLivre; } public void setDateDeRetourLivre(Date dateDeRetourLivre) { this.dateDeRetourLivre = dateDeRetourLivre; } public Date getDateFinEmprunt() { return dateFinEmprunt; } public void setDateFinEmprunt(Date dateFinEmprunt) { this.dateFinEmprunt = dateFinEmprunt; } @JsonBackReference public Client getClient() { return client; } public void setClient(Client client) { this.client = client; } @JsonBackReference public Livre getLivre() { return livre; } public void setLivre(Livre livre) { this.livre = livre; } @ManyToOne @JoinColumn(name="IdClient") private Client client; @ManyToOne @JoinColumn(name="IdLivre") private Livre livre; }
Partager