No persistence units parsed from {classpath*:META-INF/persistence.xml}

来源:3-1 开发环境搭建

qq_慕先生2446522

2018-12-19 12:27

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: No persistence units parsed from {classpath*:META-INF/persistence.xml}

和老师一样的配置代码,难道是因为jdk版本原因吗,我是1.8,是不是要用1.7

写回答 关注

1回答

  • 没有鱼骨头
    2018-12-20 15:36:12

    因为默认需要添加一个persistence.xml文件,在文件中定义实体类,并且这个文件是要在META-INF目录下的。但是也可以更改一些配置,更改后可以不再使用persistence.xml文件。具体更改看这个链接→ https://www.cnblogs.com/taven/p/3351841.html

轻松愉快之玩转SpringData

利用Spring Data提高开发效率,提升程序员的幸福指数

34091 学习 · 119 问题

查看课程