项目启动时出现错误,创建名称为'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;

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容