DefaultRepositoryMetadataResolver extends AbstractRepositoryMetadataResolver { @Override protected RepositoryMetadata resolveFromInterface(Class<?> repositoryInterface) { if (repositoryInterface.isAnnotationPresent(RepositoryDefinition.class)) { log.info( "Since the repository interface was annotated with @RepositoryDefinition we will try to resolve " + "the metadata using the provided annotation"); return annotationRepositoryMetadataResolver.resolve(repositoryInterface); } log.info( "Since no annotation was found on the repository, we will try to read the metadata from the generic " + "type parameters derived from the Repository interface"); return assignableRepositoryMetadataResolver.resolve(repositoryInterface); }    }
@Test public void testThatItResolvesUsingAnnotations() { final RepositoryMetadata metadata = new DefaultRepositoryMetadataResolver().resolveFromInterface( SampleAnnotatedRepository.class); assertThat(metadata, is(notNullValue())); }
@Test public void testThatItResolvesUsingInheritance() { final RepositoryMetadata metadata = new DefaultRepositoryMetadataResolver().resolveFromInterface( SimplePersonRepository.class); assertThat(metadata, is(notNullValue())); }
@Test public void testThatAnnotationTakesPrecedenceOverInheritance() { final RepositoryMetadata metadata = new DefaultRepositoryMetadataResolver().resolveFromInterface( AnnotatedInheritingRepository.class); assertThat(metadata, is(notNullValue())); assertThat(metadata.getEntityType(), is(Matchers.equalTo(Person.class))); }