开发者

Spring get all @Entity classes

开发者 https://www.devze.com 2023-04-03 09:25 出处:网络
Is there a way to get all @Entity classes in Spring? I can\'t seem to find any solution. Thanks. answer:

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

精彩评论

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