美好的一天.. 我正在尝试创建一个 spring boot web 应用程序,在其中我必须在 spring boot 的用户详细信息中找到用户,但是在使用测试时出现错误,这是我的配置:
用户类:
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "USERS")
public class User implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name = "USERNAME")
private String username;
@Column(name = "PASSWORD", nullable = false)
private String password;
@Column(name = "ENABLED", nullable = false)
private boolean enabled;
public User() {
super();
// TODO Auto-generated constructor stub
}
public User(String username, String password, boolean enabled, Set<Authorities> authorities, Customer customer) {
super();
this.username = username;
this.password = password;
this.enabled = enabled;
this.authorities = authorities;
this.customer = customer;
}
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private Set<Authorities> authorities = new HashSet<>();
@OneToOne(cascade = CascadeType.ALL)
private Customer customer;
//Getter and Setter methods
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<Authorities> getAuthorities() {
return authorities;
}
public void setAuthorities(Set<Authorities> authorities) {
this.authorities = authorities;
}
皈依舞
相关分类