gpt4 book ai didi

spring.job.启用: true causing junit jobs to run twice

转载 作者:行者123 更新时间:2023-12-03 09:15:07 24 4
gpt4 key购买 nike

我有一个 Spring Boot Spring Batch 项目。以下设置在我的application.yml中

# Spring Framework Standard Properties
spring:
batch:
job.enabled: true

当我将此设置设置为 true 时,如上所述,它会导致我的 junit 测试在每次启动单元测试时运行两次。

当我将设置更改为 false 时,我的 junit 测试会在启动相同的单元测试时运行一次。

几个问题...

我不是 100% 清楚这个设置是什么。谁能告诉我更多信息。

还有什么我可以在我的单元测试中放入任何东西来将其更改为 false 仅用于我的单元测试。

最佳答案

来自the official documentation:

By default a Runner will be created and all jobs in the context will be executed on startup.

Disable this behavior with spring.batch.job.enabled=false.

关于spring.job.启用: true causing junit jobs to run twice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38520625/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com