开发者

Spring get all @Entity classes

Is there a way to get all @Entity classes in Spring? I can't seem to find any solution. Thanks.

answer:

<dependency>
   <groupId&开发者_开发技巧gt;org.reflections</groupId>
   <artifactId>reflections</artifactId>
   <version>0.9.5</version>
</dependency>

will do this easily ;)


Why do you need this? I suppose you are in a JPA context, then you can do it like this:

entityManager.getMetamodel().getEntities();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜