All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.onestop.common.task.autoconfigure.OsTaskAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 0.17.15
Show newest version
/*
 *
 *  * Copyright (c) 2021 os-parent Authors. All Rights Reserved.
 *  *
 *  * Licensed under the Apache License, Version 2.0 (the "License");
 *  * you may not use this file except in compliance with the License.
 *  * You may obtain a copy of the License at
 *  *
 *  *     http://www.apache.org/licenses/LICENSE-2.0
 *  *
 *  * Unless required by applicable law or agreed to in writing, software
 *  * distributed under the License is distributed on an "AS IS" BASIS,
 *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  * See the License for the specific language governing permissions and
 *  * limitations under the License.
 *
 */

package com.onestop.common.task.autoconfigure;

import com.onestop.common.task.util.OsTaskSchedulerUtils;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * os-common-task配置
 * @author Clark
 * @version 2022-05-26
 */
@AutoConfiguration
public class OsTaskAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
        return taskScheduler;
    }

    @Bean
    @ConditionalOnBean(ThreadPoolTaskScheduler.class)
    public OsTaskSchedulerUtils osTaskSchedulerUtils() {
        OsTaskSchedulerUtils schedulerUtils = new OsTaskSchedulerUtils();
        return schedulerUtils;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy