刚开始出现下列错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in class path resource [beans.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Dialect class not found: hibernate.dialect.MySQL5Dialect
找了半天发现Dialect class not found: hibernate.dialect.MySQL5Dialect
即hibernate的方言配置错了。应为hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in class path resource [beans.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Dialect class not found: hibernate.dialect.MySQL5Dialect
找了半天发现Dialect class not found: hibernate.dialect.MySQL5Dialect
即hibernate的方言配置错了。应为hibernate.dialect=org.hibernate.dialect.MySQL5Dialect