As stated here https://github.com/spring-projects/spring-batch/issues/816, use of BatchConfigurer bean makes some obstacles for JPA, this behaviour was fixed in Spring Batch 5, but the problem is that I use spring-boot 2.7.10, while Spring Batch 5 requires 3+, are there any workarounds to make JPA work again in Spring Batch 4
You did not share your code, so I will guess.
With Spring Batch 4 / Spring Boot 2, you need to define a custom BatchConfigurer
bean to return the JpaTransactionManager
from BatchConfigurer#getTransactionManager
and use spring.main.allow-bean-definition-overriding=true
.