内容类型';应用程序/json;字符集=UTF-8';不支持Spring引导REST API

内容类型';应用程序/json;字符集=UTF-8';不支持Spring引导REST API,rest,spring-boot,postman,Rest,Spring Boot,Postman,在我的Spring Boot Rest API中,我可以从数据库(get)中获取“Usilizateurs”类实例,但当我尝试使用POST方法添加新实例时,我得到以下错误: { "timestamp": "2019-08-08T20:17:41.292+0000", "status": 415, "error": "Unsupported Media Type", "message": "Content type 'application/json;charse

在我的Spring Boot Rest API中,我可以从数据库(get)中获取“Usilizateurs”类实例,但当我尝试使用POST方法添加新实例时,我得到以下错误:


{
    "timestamp": "2019-08-08T20:17:41.292+0000",
    "status": 415,
    "error": "Unsupported Media Type",
    "message": "Content type 'application/json;charset=UTF-8' not supported",
    "path": "/utilisateurs/signup"
}
我应该更改什么以避免此不受支持的媒体类型错误?

我尝试过发送带有或不带有“Content-Type:application/json”头的post方法

这是“利用者”类:

包ma.netrent.entities;
导入java.io.Serializable;
导入java.sql.Timestamp;
导入java.util.ArrayList;
导入java.util.Date;
导入java.util.List;
导入javax.persistence.CascadeType;
导入javax.persistence.Column;
导入javax.persistence.Entity;
导入javax.persistence.FetchType;
导入javax.persistence.GeneratedValue;
导入javax.persistence.Id;
导入javax.persistence.JoinColumn;
导入javax.persistence.JoinTable;
导入javax.persistence.OneToMany;
导入javax.persistence.PrePersist;
导入javax.persistence.PreUpdate;
导入javax.persistence.Temporal;
导入javax.persistence.TemporalType;
导入com.fasterxml.jackson.annotation.JsonIgnore;
@实体
公共类利用器实现可序列化{
@身份证
@生成值
私人长id;
私有字符串图像;
私有字符串prenom;
私有字符串名称;
私人字符串电子邮件;
私有字符串密码;
私人弦乐四分器;
私家侦探;
私人字符串支付;
@列(columnDefinition=“浮点默认值-1”)
私人浮动票据;
私有布尔帐户过期;
私有布尔锁;
公共列表getRoles(){
返回角色;
}
公共void集合角色(ArrayList角色){
this.roles=角色;
}
@OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@JoinTable(name=“user\u role”,joinColumns=@JoinColumn(name=“user\u id”),inverseJoinColumns=@JoinColumn(name=“role\u id”))
私有列表角色;
@OneToMany(fetch=FetchType.LAZY)
私人名单评论;
@OneToMany(fetch=FetchType.LAZY,mappedBy=“proprietaire”,cascade=CascadeType.ALL,orphanRemoving=true)
私人名单固定者;
公共用途{
}
公用事业单位(长id){
setId(id);
}
公用事业单位(公用事业单位){
this.id=u.id;
this.image=u.image;
this.accountExpired=u.accountExpired;
this.password=u.password;
this.accountLocked=u.accountLocked;
this.commentalies=u.commentalies;
this.registrationdate=u.registrationdate;
此。防盗器=u。防盗器;
this.note=u.note;
this.prenom=u.prenom;
this.nom=u.nom;
this.email=u.email;
}
公共用户(字符串电子邮件、字符串密码、ArrayList角色){
this.roles=角色;
this.password=密码;
this.email=电子邮件;
}
公共列表GetCommentalies(){
返回评论;
}
公共评论(列表评论){
this.commentalies=评论;
}
公共长getId(){
返回id;
}
公共无效集合id(长id){
this.id=id;
}
公共布尔值isAccountExpired(){
返回帐户已过期;
}
公共无效setAccountExpired(布尔值accountExpired){
this.accountExpired=accountExpired;
}
公共布尔值isAccountLocked(){
返回帐户已锁定;
}
public void setAccountLocked(布尔accountLocked){
this.accountLocked=accountLocked;
}
@抑制警告(“弃用”)
@预科生
void onCreate(){
this.setRegisrationDate(新时间戳((新日期()).getDate());
}
@抑制警告(“弃用”)
@预更新
void onPersist(){
System.out.println(“yoyo”);
this.setRegisrationDate(新时间戳((新日期()).getDate());
}
@时态(TemporalType.DATE)
私人日期注册日期;
公共浮动getNote(){
退货单;
}
公共无效设置注释(浮动注释){
this.note=注释;
}
公共字符串getImage(){
返回图像;
}
公共void setImage(字符串图像){
这个图像=图像;
}
公共字符串getPrenom(){
返回prenom;
}
公共void setPrenom(字符串prenom){
this.prenom=prenom;
}
公共字符串getNom(){
返回名称;
}
公共无效集合名(字符串名){
this.nom=nom;
}
公共字符串getEmail(){
回复邮件;
}
公用电子邮件(字符串电子邮件){
this.email=电子邮件;
}
@杰索尼奥雷
公共字符串getPassword(){
返回密码;
}
public void setPassword(字符串密码){
this.password=密码;
}
@杰索尼奥雷
公共列表getImmobiliers(){
返回固定器;
}
公共无效设置固定器(列出固定器){
this.immobiliers=immobiliers;
}
公共字符串getQuartier(){
返回四分位数;
}
公共无效设置四分位数(字符串四分位数){
this.quartier=quartier;
}
公共字符串getVille(){
返回维尔;
}
公共空间塞特维尔(字符串维尔){
this.ville=ville;
}
公共字符串getPays(){
回报支付;
}
公共支付(字符串支付){
this.pays=支付;
}
公共日期getRegisrationDate(){
退货登记日期;
}
公共无效设置regisrationDate(日期regisrationDate){
this.registrationdate=registrationdate;
}
public void setRoles(列出角色){
this.roles=角色;
}
}
我将post请求发送给的控制员:(提款人/注册人)


包ma.netrent.controllers;
导入java.util.ArrayList;
导入java.util.List;
导入org.springframework.beans.factory.annotation.Autowired;
导入org.springframework.http.HttpHeaders;
感应电动机