spring-bootyamlquartz

spring boot - disable quartz scheduler


I need to be able to set up quartz to run depending on the profile. I am using an integration test to make sure that each profile is getting the scheduler started (or not), but I am checking a profile that doesn't have it enabled and this check is failing:

assertFalse(scheduler.isStarted());

This is what I have used for this profile in application.yaml:

spring:
  quartz:
    enabled: false

Also tried:

spring:
  quartz:
    properties:
      enabled: false

Any ideas how to get quartz to not start at all?

As a workaround, is it possible to set up a dummy scheduler on the profile so that the real quartz is skipped altogether?

PS I have noticed this, but I'd like to keep it in application.yaml if at all possible: How to disable Quartz scheduler for dev and stg environment


Solution

  • this worked:

    spring:
      quartz:
        auto-startup: false