- springboot项目映入xxljob项目的maven依赖
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
</dependency>
- 项目中的配置
xxl:
job:
accessToken: ''
admin:
addresses: http://test.docker.etests.cn/
executor:
address: ''
appname: myApp
ip: ''
logpath: /myLog
logretentiondays: 30
port: 9999
- xxljob 任务创建的两种方式
3.1 bean方式:向spring容器中丢入bean
@XxlJob("tasks")
private ReturnT<String> tasks(){}
3.2 java类的方式
@JobHandler(value = "MyJobHandler")
@Component
public class MyJobHandler extends IJobHandler {
}