我有一个 Spring Boot Spring Batch 项目。以下设置在我的application.yml中
# Spring Framework Standard Properties
spring:
batch:
job.enabled: true
当我将此设置设置为 true 时,如上所述,它会导致我的 junit 测试在每次启动单元测试时运行两次。
当我将设置更改为 false 时,我的 junit 测试会在启动相同的单元测试时运行一次。
几个问题...
我不是 100% 清楚这个设置是什么。谁能告诉我更多信息。
还有什么我可以在我的单元测试中放入任何东西来将其更改为 false 仅用于我的单元测试。
最佳答案
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/