DATACMNS-634 - Repositories now als returns repositories for super types of a domain class.
In case the repository lookup for a given domain type fails we traverse the given types super-types and try to detect a repository for those. Original pull request: #110.
This commit is contained in:
committed by
Oliver Gierke
parent
b2251aa5b9
commit
9f21cc2f28
@@ -108,10 +108,22 @@ public class RepositoriesUnitTests {
|
||||
assertThat(repositories.getPersistentEntity(Address.class), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-634
|
||||
*/
|
||||
@Test
|
||||
public void findsRepositoryForSubTypes() {
|
||||
|
||||
Repositories repositories = new Repositories(context);
|
||||
assertThat(repositories.getPersistentEntity(AdvancedAddress.class), is(notNullValue()));
|
||||
}
|
||||
|
||||
class Person {}
|
||||
|
||||
class Address {}
|
||||
|
||||
class AdvancedAddress extends Address {}
|
||||
|
||||
interface PersonRepository extends CrudRepository<Person, Long> {}
|
||||
|
||||
interface AddressRepository extends Repository<Address, Long> {}
|
||||
|
||||
Reference in New Issue
Block a user