发布请求错误邮递员收到404错误请求

时间:2018-10-15 16:31:10

标签: spring-mvc postman

我想创建一个具有角色(manyTomany)关系,程序(OneToOne)关系和位置(ManyToOne)关系的用户。

使用Postman进行发布请求时,出现以下错误     “由于某些被认为是客户端错误的原因(例如格式错误的请求语法,无效的请求消息框架或欺骗性的请求路由),服务器无法或不会处理该请求。”

@Entity

@Table(name = "users")

public class User implements Serializable {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue
private Long id;

@Column(nullable = false, name = "first_name")
private String firstName;

@Column(nullable = false, name = "last_name")
private String lastName;

@Column(nullable = false)
private String email;

@Column(nullable = false, unique = true)
private String username;

@JsonProperty(access = Access.WRITE_ONLY)
@Column(nullable = false)
private String password;

@Column(nullable = false, name = "major_unit")
private String majorORUnit;

@Column(nullable = true, name = "title")
private String title;

@OneToOne(cascade = CascadeType.ALL,targetEntity = Program.class)
private Program program;

private boolean enabled = true;

@ManyToOne(cascade = CascadeType.ALL,targetEntity = Position.class)
private Position position;

@ManyToMany(cascade = CascadeType.ALL,targetEntity = Role.class)
@JoinTable(name = "authorities", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
// @JsonBackReference
Set<Role> roles;

public User() {
    roles = new HashSet<Role>();
}

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getUsername() {
    return username;
}

public void setUsername(String username) {
    this.username = username;
}

public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password = password;
}

public boolean isEnabled() {
    return enabled;
}

public void setEnabled(boolean enabled) {
    this.enabled = enabled;
}

public Set<Role> getRoles() {
    return roles;
}

public void setRoles(Set<Role> roles) {
    this.roles = roles;
}

public String getFirstName() {
    return firstName;
}

public void setFirstName(String firstName) {
    this.firstName = firstName;
}

public String getLastName() {
    return lastName;
}

public void setLastName(String lastName) {
    this.lastName = lastName;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

public String getMajorORUnit() {
    return majorORUnit;
}

public void setMajorORUnit(String majorORUnit) {
    this.majorORUnit = majorORUnit;
}

public String getTitle() {
    return title;
}

public void setTitle(String title) {
    this.title = title;
}

public Program getProgram() {
    return program;
}

public void setProgram(Program program) {
    this.program = program;
}

public Position getPosition() {
    return position;
}

public void setPosition(Position position) {
    this.position = position;
}


}

这是我的回复正文

{
"fristName": "Kachisicho",
"lastName" : "Ani",
"email": "kachi@gmail.com",
"username": "Electrical Engineering",
"password": "abcd",
"majorOrUnit": "Electrical Engineering",
"title": " Teaching Assistant",
"program":[4],
"postion":[1],
"roles":[2]
}

0 个答案:

没有答案