From a676059699b2215f73a94f6d36d4a56acd1138cf Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 16 Sep 2019 15:17:58 +0200 Subject: [PATCH] Declare CRON_DISABLED constant value only once This commit removes the duplicated CRON_DISABLED constant value from @Scheuled and simply refers to the ScheduledTaskRegistrar.CRON_DISABLED constant. This avoids a potential package cycle by ensuring that the `annotation` package depends on the `config` package but not the other way around. See gh-23568 --- .../org/springframework/scheduling/annotation/Scheduled.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java index 24bb27c0e9..ad8a477d38 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java @@ -23,6 +23,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; + /** * Annotation that marks a method to be scheduled. Exactly one of the * {@link #cron}, {@link #fixedDelay}, or {@link #fixedRate} attributes must be @@ -60,8 +62,9 @@ public @interface Scheduled { *

This is primarily meant for use with ${...} placeholders, * allowing for external disabling of corresponding scheduled methods. * @since 5.1 + * @see ScheduledTaskRegistrar#CRON_DISABLED */ - String CRON_DISABLED = "-"; + String CRON_DISABLED = ScheduledTaskRegistrar.CRON_DISABLED; /**