各位大虾帮帮忙,小弟刚接触spring,但是在用SSH时候读取Spring配置文件的时候出现的错误如下:
org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'accountDAO' defined in file [/WEB-INF/applicationContext.xml]: Bean class [import com.worthtech.billportal.dao.hibernate.AccountHibernateDAO] not found; nested exception is java.lang.ClassNotFoundException: import com/worthtech/billportal/dao/AccountDAO
java.lang.ClassNotFoundException: import com/worthtech/billportal/dao/AccountDAO
......
我已经写了setter,getter了啊,怎么还报错啊?谢谢哪位大哥指点迷津!
private AccountDAO accountDAO;
public AccountDAO getAccountDAO() {
return accountDAO;
}
public void setAccountDAO(AccountDAO accountDAO) {
this.accountDAO = accountDAO;
}
------解决方案--------------------
in file [/WEB-INF/applicationContext.xml]:
Bean class [import.com.worthtech.billportal.dao.hibernate.AccountHibernateDAO] not found
---------------------------
没找到,确认下配置和路径之类的吧.
------解决方案--------------------
在spring配置文件中没有bean 'accountDAO'
------解决方案--------------------
>_< 说错,在spring配置文件中 bean 'accountDAO' 配置错误..
多了import
------解决方案--------------------
...那你应该把
private AccountDAO accountDAO;
public AccountDAO getAccountDAO() {
return accountDAO;
}
public void setAccountDAO(AccountDAO accountDAO) {
this.accountDAO = accountDAO;
}
放在AccountServiceImp 里面
然后调用dao方法