I have a microservice where multiple @DataJpaIntegrationTest junit tests are present. As soon as I am adding @EnableBatchProcessing , all junits annotated with @DataJpaIntegrationTest are failing.
Problem seem to be as no transaction is happening.
I am using custom batch configurer to use Map based JobRepository utilizing Resourceless transactionManager.
@DataJpaIntegrationTest looks as below:
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@SpringBootTest
@Transactional
@AutoConfigureDataJpa
@AutoConfigureTestDatabase
@AutoConfigureTestEntityManager
@TestPropertySource(properties = {
"spring.cloud.stream.function.definition="
})
public @interface DataJpaIntegrationTest {
}
Let me know if further details are required
I got the root cause of the problem but unaware of the solution. As soon as I removed custom batch configurer , everything started working fine.
However, @DataJpaTest is still failing with below reason
"eventSource":"org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer","message":"No transaction manager was provided, using a DataSourceTransactionManager"
How can I have the jpa transaction intact while using map based repository.