I'm using spring batch 4.0 and i'm trying to test my batch. I would use embedded database h2 with @JpaDataTest but it doesn't work. When i add this annotation i got error
java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).
@Transaction(propagation=Propagation.NEW_REQUIRED) on the @Test dosen't work.
I tried to copy every annotations from @JpaDataTest and remove @Transaction
@BootstrapWith(SpringBootTestContextBootstrapper.class)
@OverrideAutoConfiguration(enabled = false)
@AutoConfigureCache
@AutoConfigureDataJpa
@AutoConfigureTestDatabase
@AutoConfigureTestEntityManager
@ImportAutoConfiguration
But when i'm doing this, i'm lossing the EntityManager...
Someone already find a solution ?
@DataJpaTest
(assuming you mean that instead of@JpaDataTest
) class with@Transactional(propagation = NOT_SUPPORTED)
? – Sam Brannen