Created
June 1, 2021 06:15
-
-
Save A-pZ/cb66e876265482500c24b20196caf05c to your computer and use it in GitHub Desktop.
Enable ShedLock Setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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