gpt4 book ai didi

java - Bean 属性 'sessionFactory' 不可写或具有无效的设置方法

转载 作者:行者123 更新时间:2023-11-30 10:46:00 29 4
gpt4 key购买 nike

我有 1 个错误:

bean 类 [com.aptech.mavenspringmvc.dao.StudentDAOImpl] 的无效属性“sessionFactory”:Bean 属性“sessionFactory”不可写或具有无效的 setter 方法。 setter的参数类型是否匹配getter的返回类型?

enter image description here

enter image description here

文件DAO工具

@Repository
public class StudentDAOImpl implements StudentDAO{
@Autowired
public SessionFactory session;

文件 DAO

@Service
public class StudentServiceImpl implements StudentService{

//@Autowired
public StudentDAO studao;

public void setStudao(StudentDAO studao) {
this.studao = studao;
}

public StudentDAO getStudao() {
return studao;
}

文件 Controller

@Controller
public class StudentController {
// @Autowired
private StudentService stuSer;

最佳答案

@Repository
public class StudentDAOImpl implements StudentDAO{

@Autowired
public SessionFactory sessionFactory;
....

public void setSessionFactory(SessionFactory sessionFactory){
this.sessionFactory = sessionFactory;
}
}

关于java - Bean 属性 'sessionFactory' 不可写或具有无效的设置方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36785258/

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