问题
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.
i've tried the @ComponentScan(excludeFilters... approach but it still gets invoked.
any way to switch off this 'helper' class?
回答1:
You can set spring.batch.job.enabled=false or you can set spring.batch.job.names=none (see source code for details).
来源:https://stackoverflow.com/questions/27752434/spring-boot-batch-execluding-joblaunchercommandlinerunner