001/*
002 * Copyright 2002-2016 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.beans.factory.config.BeanDefinition;
020import org.springframework.context.annotation.Bean;
021import org.springframework.context.annotation.Configuration;
022import org.springframework.context.annotation.Role;
023import org.springframework.scheduling.config.TaskManagementConfigUtils;
024
025/**
026 * {@code @Configuration} class that registers a {@link ScheduledAnnotationBeanPostProcessor}
027 * bean capable of processing Spring's @{@link Scheduled} annotation.
028 *
029 * <p>This configuration class is automatically imported when using the
030 * {@link EnableScheduling @EnableScheduling} annotation. See
031 * {@code @EnableScheduling}'s javadoc for complete usage details.
032 *
033 * @author Chris Beams
034 * @since 3.1
035 * @see EnableScheduling
036 * @see ScheduledAnnotationBeanPostProcessor
037 */
038@Configuration
039@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
040public class SchedulingConfiguration {
041
042        @Bean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)
043        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
044        public ScheduledAnnotationBeanPostProcessor scheduledAnnotationProcessor() {
045                return new ScheduledAnnotationBeanPostProcessor();
046        }
047
048}