【问题标题】:Spring get all @Entity classesSpring获取所有@Entity类
【发布时间】:2011-09-07 09:30:46
【问题描述】:

有没有办法在 Spring 中获取所有 @Entity 类? 我似乎找不到任何解决方案。 谢谢。

答案:

<dependency>
   <groupId>org.reflections</groupId>
   <artifactId>reflections</artifactId>
   <version>0.9.5</version>
</dependency>

很容易做到这一点;)

【问题讨论】:

    标签: spring entity


    【解决方案1】:

    为什么需要这个?我想你在 JPA 上下文中,那么你可以这样做:

    entityManager.getMetamodel().getEntities();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-16
      • 1970-01-01
      • 1970-01-01
      • 2017-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多