项目启动时出现错误,创建名称为'entityManagerFactory'的bean。...错误

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: com.yunrui.weixin.user.pojo.User

运行项目会出现这种错误。哪里出错???

1.模型类有添加@Entiy注解么,有

2.看看是不是ID 导包倒错了,一定要注意是

导入javax.persistence.Id;

果然 随手写了一个

import org.springframework.data.annotation.Id;

@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

private Integer id;

你可能感兴趣的:(项目启动时出现错误,创建名称为'entityManagerFactory'的bean。...错误)