@EnableBatchProcessing中断其他JPA junit测试

问题描述

我有一个微服务,其中存在多个@DataJpaIntegrationTest junit测试。当我添加@EnableBatchProcessing时,所有带有@DataJpaIntegrationTest注释的junits都将失败。

问题似乎在于没有交易在发生。

我正在使用自定义批处理配置程序,以通过无资源transactionManager使用基于Map的JobRepository。

@DataJpaIntegrationTest如下所示:

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@SpringBoottest
@Transactional
@AutoConfigureDataJpa
@AutoConfigureTestDatabase
@AutoConfigureTestEntityManager
@TestPropertySource(properties = {
        "spring.cloud.stream.function.deFinition="
})
public @interface DataJpaIntegrationTest {
}

让我知道是否需要更多详细信息

我找到了问题的根本原因,但不知道解决方案。 删除自定义批处理配置程序后,一切开始正常运行。

但是,由于以下原因,@ DataJpaTest仍然失败

"eventSource":"org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer","message":"No transaction manager was provided,using a DataSourceTransactionManager"

在使用基于地图的存储库时如何保留jpa事务。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)