Spring Cloud version "Hoxton.SR9"
Under some condition deadlock happens with Openfeign + deferred JPA repository. I can reproduce the case only in tests.
I created a simple project to reproduce the problem: https://github.com/michaldo/feign-jpa-deffered-deadlock
I think the same case is reported on https://stackoverflow.com/questions/65078382/spring-boot-context-load-test-hangs
I guess the reason is that FeignClientFactoryBean does not extend AbstractFactoryBean
Comment From: OlgaMaciaszek
@michaldo Thanks for reporting this.
Further analysis:
From here new child context is being created, which triggers ContextRefreshedEvent. DataSourceInitializedPublisher listens on this event and tries to get dataSourceInitialization future. This is causing a deadlock.
dataSourceIniitialization is being initialized within the postProcessEntityManagerFactory method.
Comment From: OlgaMaciaszek
The problem seems to be in Spring Boot. Have created https://github.com/spring-projects/spring-boot/issues/24966. Also, upgrading to Boot 2.3.7 should help as the deferred mode was set to non-default (https://github.com/spring-projects/spring-boot/issues/24249).
Closing in favour of the Spring Boot issues.
Comment From: michaldo
Initially Spring Boot guys told it is OpenFeing issue :)