Error message
Exception in thread "main" java.lang.ClassCastException: com.itheima.dao.impl.UserDaoImpl cannot be cast to com.itheima.dao.UserDao
at com.itheima.demo.UserDaoDemo.main(UserDaoDemo.java:10)
Copy the code
The error code is
UserDao userDao = (UserDao) app.getBean("userDao");
Copy the code
UserDaoImpl forgot to implement the interface UserDao
public class UserDaoImpl implements UserDao {
public void save(a){
System.out.println("save running...");
}
Copy the code