gpt4 book ai didi

java - java 编程中构造函数未定义

转载 作者:行者123 更新时间:2023-12-02 01:51:06 24 4
gpt4 key购买 nike

我正在尝试创建一个构造函数,每当您运行我的程序时,它都会自动输入用户,如果数据库中没有用户,则输入管理员。

@Entity
@Table(name = "fmsusers")
public class UsersVO {

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "userId")
private Long userId;

@Column(name = "userEmail")
private String userEmail;

@Column(name = "password")
private String password;

@Transient
private String passwordConfirm;

@Column(name = "firstName")
private String firstName;

@Column(name = "lastName")
private String lastName;

@Column(name = "phoneNumber")
private String phoneNumber;

@Column(name = "Enabled", length = 1)
private boolean enabled;

@ManyToManyenter code here
@JoinTable(name = "user_role",
joinColumns = @JoinColumn(name = "user_id"),
inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<RolesVO> rolesVO;


public static List<UsersVO> usersInit() throws Exception {

List<UsersVO> initUsers = new ArrayList<UsersVO>();
try {
initUsers.add(new UsersVO(1,"admin@gmail.com", "$2a$10$PrI5Gk9L.tSZiW9FXhTS8O8Mz9E97k2FZbFvGFFaSsiTUIl.TCrFu", "$2a$10$PrI5Gk9L.tSZiW9FXhTS8O8Mz9E97k2FZbFvGFFaSsiTUIl.TCrFu",
"Claude", "Kabayiza","0783240776", true));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return initUsers;
}
}

构造函数 UsersVO(int, String, String, String, String, String, String, boolean) 未定义

最佳答案

您还没有使用您输入的参数定义构造函数,因此Java只知道没有任何参数的默认构造函数。

关于java - java 编程中构造函数未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57425660/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com