Given the list of all spring data repositories in some class Bar
:
@Autowired
private List<Repository> repositories;
How can I find the repository for an existing domain class Foo
in the above list?
Assuming that the following exists:
@Entity
public class Foo {
...
}
and
public interface FooRepository extends JpaRepository<Foo, String> {}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…