Skip to content

Commit b331ad5

Browse files
committed
Explicit note on scheduled methods with a return value
Issue: SPR-14195
1 parent ce2f28d commit b331ad5

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
import java.lang.annotation.Target;
2525

2626
/**
27-
* Annotation that marks a method to be scheduled. Exactly one of the
28-
* {@link #cron()}, {@link #fixedDelay()}, or {@link #fixedRate()}
27+
* An annotation that marks a method to be scheduled. Exactly one of
28+
* the {@link #cron()}, {@link #fixedDelay()}, or {@link #fixedRate()}
2929
* attributes must be specified.
3030
*
31-
* <p>The annotated method must expect no arguments and have a
32-
* {@code void} return type.
31+
* <p>The annotated method must expect no arguments. It will typically have
32+
* a {@code void} return type; if not, the returned value will be ignored
33+
* when called through the scheduler.
3334
*
3435
* <p>Processing of {@code @Scheduled} annotations is performed by
3536
* registering a {@link ScheduledAnnotationBeanPostProcessor}. This can be

spring-context/src/main/resources/org/springframework/scheduling/config/spring-task-4.3.xsd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@
293293
<xsd:attribute name="method" type="xsd:string" use="required">
294294
<xsd:annotation>
295295
<xsd:documentation><![CDATA[
296-
The name of the method to be invoked.
296+
The name of the method to be invoked. The target method must expect no arguments.
297+
It will typically have a void return type; if not, the returned value will be
298+
ignored when called through the scheduler.
297299
]]></xsd:documentation>
298300
<xsd:appinfo>
299301
<tool:annotation>

0 commit comments

Comments
 (0)