Where do I put META-INF in Eclipse?

独自空忆成欢 提交于 2019-11-28 08:09:39

It shouldn't be at the project root, but directly under the source folder.

At runtime, the persistence.xml file is searched in the classpath, under META-INF. So if you want the META-INF folder to be put at the top of the compiled package tree, you need to put it at the top of the source tree. Eclipse copies every non-Java file to its output directory (bin, by default), respecting the package/folder hierarchy.

vivek mishra

Basically it has to be in your classpath(under /META-INF/). You can manually enable it in eclipse by configuring properties. If your project is maven based, then it should be automatically picked from /src/main/resources/META-INF/ folder (provided entities are under the same hood).

It should be under src/main/resources directory,

The full path will be /src/main/resources/META-INF/persistence.xml

After creating the META-INF folder under resources directory and having a persistence.xml file loads the entityMangerFactory bean properly,

<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />

The above line reads the path correctly.

If you are using Eclipse, right-click on 'src' folder, choose 'Build Path', then 'Use as Source Folder'

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!