diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/EnableScheduling.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/EnableScheduling.java index d94b5f5e9c..e35b0a7992 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/EnableScheduling.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/EnableScheduling.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; /** * Enables Spring's scheduled task execution capability, similar to * functionality found in Spring's {@code } XML namespace. To be used - * on @{@link Configuration} classes as follows: + * on {@link Configuration @Configuration} classes as follows: * *
  * @Configuration
@@ -41,8 +41,8 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
  *     // various @Bean definitions
  * }
* - * This enables detection of @{@link Scheduled} annotations on any Spring-managed - * bean in the container. For example, given a class {@code MyTask} + *

This enables detection of {@link Scheduled @Scheduled} annotations on any + * Spring-managed bean in the container. For example, given a class {@code MyTask}: * *

  * package com.myco.tasks;
@@ -55,7 +55,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
  *     }
  * }
* - * the following configuration would ensure that {@code MyTask.work()} is called + *

the following configuration would ensure that {@code MyTask.work()} is called * once every 1000 ms: * *

@@ -69,7 +69,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
  *     }
  * }
* - * Alternatively, if {@code MyTask} were annotated with {@code @Component}, the + *

Alternatively, if {@code MyTask} were annotated with {@code @Component}, the * following configuration would ensure that its {@code @Scheduled} method is * invoked at the desired interval: * @@ -80,7 +80,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; * public class AppConfig { * } * - * Methods annotated with {@code @Scheduled} may even be declared directly within + *

Methods annotated with {@code @Scheduled} may even be declared directly within * {@code @Configuration} classes: * *

@@ -94,7 +94,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
  *     }
  * }
* - *

By default, will be searching for an associated scheduler definition: either + *

By default, Spring will search for an associated scheduler definition: either * a unique {@link org.springframework.scheduling.TaskScheduler} bean in the context, * or a {@code TaskScheduler} bean named "taskScheduler" otherwise; the same lookup * will also be performed for a {@link java.util.concurrent.ScheduledExecutorService} @@ -141,11 +141,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; * public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { * taskRegistrar.setScheduler(taskScheduler()); * taskRegistrar.addTriggerTask( - * new Runnable() { - * public void run() { - * myTask().work(); - * } - * }, + * () -> myTask().work(), * new CustomTrigger() * ); * } @@ -165,7 +161,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; * configuration: * *

- * <beans>
+ * <beans>
  *
  *     <task:annotation-driven scheduler="taskScheduler"/>
  *
@@ -180,13 +176,13 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
  * </beans>
  * 
* - * The examples are equivalent save that in XML a fixed-rate period is used + *

The examples are equivalent save that in XML a fixed-rate period is used * instead of a custom {@code Trigger} implementation; this is because the * {@code task:} namespace {@code scheduled} cannot easily expose such support. This is * but one demonstration how the code-based approach allows for maximum configurability - * through direct access to actual componentry.

+ * through direct access to actual componentry. * - * Note: {@code @EnableScheduling} applies to its local application context only, + *

Note: {@code @EnableScheduling} applies to its local application context only, * allowing for selective scheduling of beans at different levels. Please redeclare * {@code @EnableScheduling} in each individual context, e.g. the common root web * application context and any separate {@code DispatcherServlet} application contexts, 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 468906a614..f3aa81296a 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 @@ -38,7 +38,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; *

Processing of {@code @Scheduled} annotations is performed by * registering a {@link ScheduledAnnotationBeanPostProcessor}. This can be * done manually or, more conveniently, through the {@code } - * element or @{@link EnableScheduling} annotation. + * XML element or {@link EnableScheduling @EnableScheduling} annotation. * *

This annotation may be used as a meta-annotation to create custom * composed annotations with attribute overrides. diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java index 5e47ccda54..f0aae20346 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java @@ -78,9 +78,10 @@ import org.springframework.util.StringUtils; import org.springframework.util.StringValueResolver; /** - * Bean post-processor that registers methods annotated with @{@link Scheduled} - * to be invoked by a {@link org.springframework.scheduling.TaskScheduler} according - * to the "fixedRate", "fixedDelay", or "cron" expression provided via the annotation. + * Bean post-processor that registers methods annotated with + * {@link Scheduled @Scheduled} to be invoked by a + * {@link org.springframework.scheduling.TaskScheduler} according to the + * "fixedRate", "fixedDelay", or "cron" expression provided via the annotation. * *

This post-processor is automatically registered by Spring's * {@code } XML element, and also by the @@ -88,8 +89,9 @@ import org.springframework.util.StringValueResolver; * *

Autodetects any {@link SchedulingConfigurer} instances in the container, * allowing for customization of the scheduler to be used or for fine-grained - * control over task registration (e.g. registration of {@link Trigger} tasks. - * See the @{@link EnableScheduling} javadocs for complete usage details. + * control over task registration (e.g. registration of {@link Trigger} tasks). + * See the {@link EnableScheduling @EnableScheduling} javadocs for complete usage + * details. * * @author Mark Fisher * @author Juergen Hoeller @@ -153,7 +155,8 @@ public class ScheduledAnnotationBeanPostProcessor /** * Create a {@code ScheduledAnnotationBeanPostProcessor} delegating to the * specified {@link ScheduledTaskRegistrar}. - * @param registrar the ScheduledTaskRegistrar to register @Scheduled tasks on + * @param registrar the ScheduledTaskRegistrar to register {@code @Scheduled} + * tasks on * @since 5.1 */ public ScheduledAnnotationBeanPostProcessor(ScheduledTaskRegistrar registrar) { diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfigurer.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfigurer.java index 05283e3fd5..26f0076077 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfigurer.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,17 @@ package org.springframework.scheduling.annotation; import org.springframework.scheduling.config.ScheduledTaskRegistrar; /** - * Optional interface to be implemented by @{@link - * org.springframework.context.annotation.Configuration Configuration} classes annotated - * with @{@link EnableScheduling}. Typically used for setting a specific + * Optional interface to be implemented by {@link + * org.springframework.context.annotation.Configuration @Configuration} classes annotated + * with {@link EnableScheduling @EnableScheduling}. Typically used for setting a specific * {@link org.springframework.scheduling.TaskScheduler TaskScheduler} bean to be used when * executing scheduled tasks or for registering scheduled tasks in a programmatic - * fashion as opposed to the declarative approach of using the @{@link Scheduled} - * annotation. For example, this may be necessary when implementing {@link - * org.springframework.scheduling.Trigger Trigger}-based tasks, which are not supported by - * the {@code @Scheduled} annotation. + * fashion as opposed to the declarative approach of using the + * {@link Scheduled @Scheduled} annotation. For example, this may be necessary + * when implementing {@link org.springframework.scheduling.Trigger Trigger}-based + * tasks, which are not supported by the {@code @Scheduled} annotation. * - *

See @{@link EnableScheduling} for detailed usage examples. + *

See {@link EnableScheduling @EnableScheduling} for detailed usage examples. * * @author Chris Beams * @since 3.1