001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.scheduling.annotation; 018 019import org.springframework.scheduling.config.ScheduledTaskRegistrar; 020 021/** 022 * Optional interface to be implemented by @{@link 023 * org.springframework.context.annotation.Configuration Configuration} classes annotated 024 * with @{@link EnableScheduling}. Typically used for setting a specific 025 * {@link org.springframework.scheduling.TaskScheduler TaskScheduler} bean to be used when 026 * executing scheduled tasks or for registering scheduled tasks in a <em>programmatic</em> 027 * fashion as opposed to the <em>declarative</em> approach of using the @{@link Scheduled} 028 * annotation. For example, this may be necessary when implementing {@link 029 * org.springframework.scheduling.Trigger Trigger}-based tasks, which are not supported by 030 * the {@code @Scheduled} annotation. 031 * 032 * <p>See @{@link EnableScheduling} for detailed usage examples. 033 * 034 * @author Chris Beams 035 * @since 3.1 036 * @see EnableScheduling 037 * @see ScheduledTaskRegistrar 038 */ 039public interface SchedulingConfigurer { 040 041 /** 042 * Callback allowing a {@link org.springframework.scheduling.TaskScheduler 043 * TaskScheduler} and specific {@link org.springframework.scheduling.config.Task Task} 044 * instances to be registered against the given the {@link ScheduledTaskRegistrar} 045 * @param taskRegistrar the registrar to be configured. 046 */ 047 void configureTasks(ScheduledTaskRegistrar taskRegistrar); 048 049}