DATACMNS-1620 - Repository bean definitions now contain human readable resource descriptions.

We now expose human readable resource descriptions based on RepositoryConfiguration and RepositoryConfigurationSource. Spring Boot uses those to describe problematic bean definitions in case it detects errors in the application setup.
This commit is contained in:
Oliver Drotbohm
2019-12-09 17:29:37 +01:00
parent 1c9fa2f365
commit 8fe3b9983a
7 changed files with 67 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupportUnitTests.DummyConfigurationExtension;
import org.springframework.util.ClassUtils;
/**
* Integration tests for {@link RepositoryBeanDefinitionRegistrarSupport}.
@@ -91,4 +92,15 @@ public class RepositoryBeanDefinitionRegistrarSupportIntegrationTests {
public void composedRepositoriesShouldBeAssembledCorrectly() {
assertThat(context.getBean(ComposedRepository.class).getOne()).isEqualTo("one");
}
@Test // DATACMNS-1620
public void registeredBeanDefinitionsContainHumanReadableResourceDescription() {
BeanDefinition definition = context.getBeanDefinition("myRepository");
assertThat(definition.getResourceDescription()) //
.contains(MyRepository.class.getName()) //
.contains(EnableRepositories.class.getSimpleName()) //
.contains(ClassUtils.getShortName(SampleConfig.class));
}
}