When creating a Spring Boot + Spring Data project which contains a JPA repository and in which the application context's class loader is set to be different than the current thread's class loader, the application context fails to start. The following exception is thrown:
The issue seems to be in the class org.springframework.data.repository.core.support.RepositoryFactorySupport at line 394, where the TransactionalProxy is loaded using the current thread's class loader instead of the application context's class loader. Please see the attached github link for a gradle demo project.
The work around for this issue is to set the class loader of the current thread to be the same to the class loader of the application context before calling the ctx.refresh(…) method,