Closed Huber-Maxi closed 11 months ago
Thanks for the sample. The problem caused by a condition on BatchAutoConfiguration
:
@ConditionalOnMissingBean(value = DefaultBatchConfiguration.class, annotation = EnableBatchProcessing.class)
Looking for beans annotated with @EnableBatchProcessing
causes testEntityJpaRepository
to be created earlier, and crucially before AutowiredAnnotationBeanPostProcessor
has been registered. This prevents the autowiring of JpaRepositoryFactoryGenerator
into your custom repository factory bean.
We'll have to review the use of the condition and/or how the condition is implemented.
I think https://github.com/spring-projects/spring-boot/issues/17594 may have caused this. The old BeanTypeRegistry
avoided initialization of factory beans when looking for beans with a particular annotation. The replacement code doesn't not do so.
We recently updated our software from spring 2.7.14 to version 3.1.5. There is a simple demo of this in my repository. We noticed that there occurs an error when having a
JpaRepositoryFactoryGenerator
for aCustomJpaRepositoryFactory
in combination with thespring-batch-core
dependency which leads to the following stacktrace: