org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.zj.usersdaoimpl.UserDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\apache-tomcat-7.0.42\webapps\CopyStart3\WEB-INF\classes\applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Composite-id class must implement Serializable: com.zj.entity.Friend
这么一长串,看了半天,我发现我的bean配置没有问题。居然说错误的去创建 叫做userDaoImpl的bean。我也是醉醉的,我真看不懂错误是啥
但是!!我个人觉得重点在最后com.zj.entity.Friend,maybe这个是实体类有问题。果真我发现我的注解有问题,删掉不确定的注解就没有问题了。
ps:很多错误提示都是一长串,有时候可能误导你,so,you can see the last sentence!I hope this can help you!