Skip to content

Instantly share code, notes, and snippets.

@A-pZ
Created June 1, 2021 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save A-pZ/cb66e876265482500c24b20196caf05c to your computer and use it in GitHub Desktop.
Save A-pZ/cb66e876265482500c24b20196caf05c to your computer and use it in GitHub Desktop.
Enable ShedLock Setting
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock;
@SpringBootApplication
@EnableScheduling
// EnableSchedulerLockの属性値に指定する時間フォーマットはjava.time.Durationを利用。
// https://en.wikipedia.org/wiki/ISO_8601#Durations
// MostForはロック時間の最長。LeastFor は ロック時間の最短。
@EnableSchedulerLock(defaultLockAtMostFor = "PT5M", defaultLockAtLeastFor = "PT30S")
public class SchedulerSampleApplication {
public static void main(String[] args) {
SpringApplication.run(SchedulerSampleApplication.class, args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment