@Bean
  Task<Void> recurringSampleTask(CounterService counter) {
    return Tasks.recurring(BASIC_RECURRING_TASK, fixedDelay(Duration.ofMinutes(1)))
        .execute(
            (instance, ctx) -> {
              log.info("Running recurring-simple-task. Instance: {}, ctx: {}", instance, ctx);
              counter.increase();
              EventLogger.logTask(
                  BASIC_RECURRING_TASK, "Ran. Run-counter current-value=" + counter.read());
            });
  }
Define a recurring task with a dependency, which will automatically be picked up by the Spring
Boot autoconfiguration.
examples/spring-boot-example/src/main/java/com/github/kagkarlsson/examples/boot/config/BasicExamplesConfiguration.java