У меня есть класс с именем Entity, который является типом javax.persistance.Entity,
Отправка запроса в контроллер покоя Spring.Я получаю сообщение об ошибке ниже
2018-12-20 14: 10: 35.829 WARN 22332 --- [nio-8080-exec-3] .cjMappingJackson2HttpMessageConverter: Не удалось оценить десериализацию Джексона для типа [[простой тип, класс com.model.Application]]: com.fasterxml.jackson.databind.JsonMappingException: Невозможно десериализовать класс javax.persistence.Entity (аннотации типа) в виде компонента Bean 2018-12-20 14: 10: 35.832 WARN 22332--- [nio-8080-exec-3] .cjMappingJackson2HttpMessageConverter: не удалось оценить десериализацию Джексона для типа [[простой тип, класс com.model.Application]]: com.fasterxml.jackson.databind.JsonMappingException: невозможно десериализовать класс javax.persistence.Entity (аннотации типа) в виде компонента Bean 2018-12-20 14: 10: 35.837 DEBUG 22332 --- [nio-8080-exec-3] .wsmmaServletInvocableHandlerMethod: не удалось разрешить аргумент 0 типа 'com.model.Application '
org.springframework.web.HttpMediaTypeNotSupportedException: тип содержимого' application / json; charset = UTF-8 'не поддерживается в org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters (AbstractMessageConverterMethodArgumentResolver.java:226) ~ [spring-webmvc-5.0.9.RELASE.we.r..mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters (RequestResponseBodyMethodProcessor.java:157) ~ [spring-webmvc-5.0.9.RELEASE.jar: 5.0.9.RELEASE] в org.spr.we.ho.me.annotation.RequestResponseBodyMethodProcessor.resolveArgument (RequestResponseBodyMethodProcessor.java:130) ~ [spring-webmvc-5.0.9.RELEASE.jar: 5.0.9.RELEASE] в org.springframework.eth: 124) ~ [spring-web-5.0.9.RELEASE.jar: 5.0.9.RELEASE] в org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues (InvocableHandlerMethod.java:161) [spring-web-5.0.9.RELEASE.jar: 5.0.9.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest (InvocableHandlerMethod.java:131) [spring-web-5.0.9.RELEASE.jar: 5.0.9.RELEASE] в org.springframework.we.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle (ServletInvocableHandlerMethod.java:102) [spring-webmvc-5.0.9.RELEASE.jar: 5.0.9.RELEASE] в org.springframelet.web.net.RequestMappingHandlerAdapter.invokeHandlerMethod (RequestMappingHandlerAdapter.java:891) [spring-webmvc-5.0.9.RELEASE.jar: 5.0.9.RELEASE] в org.springframework.web.servlet.mvc.method.annoter.HestlerManagerJava: 797) [spring-webmvc-5.0.9.RELEASE.jar: 5.0.9.RELEASE]
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@Entity
@Table(name = "applications")
public class Application implements Serializable {
protected Long id;
protected String name;
protected String createdBy;
protected Long createdTime;
protected String modifiedBy;
protected Long modifiedTime;
public Application() {
}
public Application(Long id, String name, String createdBy, Long createdTime, String modifiedBy, Long modifiedTime) {
this.id = id;
this.name = name;
this.createdBy = createdBy;
this.createdTime = createdTime;
this.modifiedBy = modifiedBy;
this.modifiedTime = modifiedTime;
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", columnDefinition = "int(11)")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "name", length = 128)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "createdBy", columnDefinition = "VARCHAR(128)", nullable = false)
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
@Column(name = "createdTime", columnDefinition = "DATETIME default CURRENT_TIMESTAMP")
public Long getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Long createdTime) {
this.createdTime = createdTime;
}
@Column(name = "modifiedBy", columnDefinition = "VARCHAR(128)")
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
@Column(name = "modifiedTime", columnDefinition = "DATETIME default CURRENT_TIMESTAMP")
public Long getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Long modifiedTime) {
this.modifiedTime = modifiedTime;
}
}
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.sql.Date;
import java.util.Objects;
// TODO: Enable for JPA and modify as needed to save linked entities. Modify as needed
@javax.persistence.Entity
@Table(name = "entities")
public class Entity implements Serializable {
protected Long id;
protected String name;
protected int active;
protected String fields;
protected String createdBy;
protected Date createdTime;
protected String modifiedBy;
protected Date modifiedTime;
protected Long appId;
public DiabloEntity() {
}
public DiabloEntity(Long id, String name, String fields, String createdBy, Date createdTime, String modifiedBy, Date modifiedTime) {
this.id = id;
this.name = name;
this.fields = fields;
this.createdBy = createdBy;
this.createdTime = createdTime;
this.modifiedBy = modifiedBy;
this.modifiedTime = modifiedTime;
}
@Column(name = "name", columnDefinition = "VARCHAR(128)", nullable = false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", columnDefinition = "INT(11)")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "appId", columnDefinition = "INT(11)")
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;//application.getId();
}
@Column(name = "fields", columnDefinition = "JSON")
public String getFields() {
return fields;
}
public void setFields(String fields) {
this.fields = fields;
}
@Column(name = "createdBy", columnDefinition = "VARCHAR(128)", nullable = false)
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
@Column(name = "createdTime", columnDefinition = "INT(11)")
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
@Column(name = "modifiedBy", columnDefinition = "VARCHAR(128)")
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
@Column(name = "modifiedTime", columnDefinition = "INT(11)")
public Date getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
@Column(name = "active", columnDefinition = "INT(1)")
public int getActive() {
return active;
}
public void setActive(int active) {
this.active = active;
}
}