feat: 添加 spring-boot-job starter.

This commit is contained in:
ljh01459796
2023-06-25 20:31:45 +08:00
parent 176f3d9a3f
commit a650723962
3 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.orion.ops</groupId>
<artifactId>orion-ops-framework</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>orion-ops-spring-boot-starter-job</artifactId>
<name>${project.artifactId}</name>
<packaging>jar</packaging>
<description>项目定时任务配置包</description>
<url>https://github.com/lijiahangmax/orion-ops-pro</url>
<dependencies>
<dependency>
<groupId>com.orion.ops</groupId>
<artifactId>orion-ops-common</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,34 @@
package com.orion.ops.framework.job.config;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
/**
* 调度器配置
* <p>
* TODO 后面业务扩展需要加上quartz的配置
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/25 16:58
*/
@EnableScheduling
@AutoConfiguration
public class OrionSchedulerAutoConfiguration {
/**
* @return 调取器
*/
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(4);
scheduler.setRemoveOnCancelPolicy(true);
scheduler.setThreadNamePrefix("scheduling-task-");
return scheduler;
}
}

View File

@@ -0,0 +1 @@
com.orion.ops.framework.job.config.OrionSchedulerAutoConfiguration