Spring Boot Batch - 不包括 JobLauncherCommandLineRunner [英] Spring Boot Batch - execluding JobLauncherCommandLineRunner
问题描述
我在 Spring Boot 中配置了一个简单的 Spring Batch 作业(类似于 spring guides).在启动时,它会自动检测并调用 JobLauncherCommandLineRunner,我想停止这种行为.我希望作业仅由应用程序中其他地方的已定义触发器触发,而不是在启动时触发.
i have a simple Spring Batch job configured in Spring Boot (something similar to the spring guides). at startup, it auto-detects and invokes JobLauncherCommandLineRunner and i want to stop that behavior. I want the job to only be fired by a defined trigger elsewhere in the app, not on startup.
我已经尝试了 @ComponentScan(excludeFilters...
方法,但它仍然被调用.
i've tried the @ComponentScan(excludeFilters...
approach but it still gets invoked.
有什么办法可以关闭这个助手"类?
any way to switch off this 'helper' class?
推荐答案
你可以设置 spring.batch.job.enabled=false
或者你可以设置 spring.batch.job.names=none
(见 源代码了解详情).
You can set spring.batch.job.enabled=false
or you can set spring.batch.job.names=none
(see source code for details).
这篇关于Spring Boot Batch - 不包括 JobLauncherCommandLineRunner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!