DATACMNS-1734 - Defer initialization of Repositories in DomainClassConverter.

DomainClassConverter now delays the initialization of the Repositories instances used to avoid the premature initialization of repository instances as that can cause deadlocks if the infrastructure backing the repositories is initialized on a separate thread.

Refactored nested converter classes to allow them to be static ones.

Related issues: spring-projects/spring-boot#16230, spring-projects/spring-framework#25131.
Original pull request: #445.
This commit is contained in:
Oliver Drotbohm
2020-05-26 18:05:26 +02:00
committed by Mark Paluch
parent 644b65eb71
commit 210ab249e3
2 changed files with 30 additions and 10 deletions

View File

@@ -29,7 +29,6 @@ import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -181,6 +180,7 @@ class DomainClassConverterUnitTests {
void toIdConverterDoesNotMatchIfTargetTypeIsAssignableFromSource() throws NoSuchMethodException {
converter.setApplicationContext(initContextWithRepo());
assertMatches(false);
@SuppressWarnings("rawtypes")
Optional<ToIdConverter> toIdConverter = (Optional<ToIdConverter>) ReflectionTestUtils.getField(converter,