学习xxl-job踩坑记录

xxx-job学习时跟着这个网站走
https://www.xuxueli.com/xxl-job/#《分布式任务调度平台XXL-JOB》
开始非常顺利
到了“2.4 配置部署“执行器项目”这一章节时,始终无法执行xxl-job-executor-sample-springboot 的 maven -> install ,一致报告Failed to collect dependencies at com.xuxueli:xxl-job-core
找了很久的问题,怀疑过版本是snapshot的问题,但在本地依赖目录里面xxl-job-core的目录结构一点问题都没有。
知道找到这篇文章,才搞定
https://blog.csdn.net/zlc521520/article/details/103425798

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,请确保您已经安装好了Xxl-JobSpringBoot,接下来是整合的步骤记录: 1.添加依赖:在pom.xml文件中添加以下依赖 ```xml <dependency> <groupId>com.xxl-job</groupId> <artifactId>xxl-job-core</artifactId> <version>${xxl.job.version}</version> </dependency> <dependency> <groupId>com.xxl-job</groupId> <artifactId>xxl-job-spring-boot-starter</artifactId> <version>${xxl.job.version}</version> </dependency> ``` 其中${xxl.job.version}根据实际情况进行替换。 2.配置文件:在application.properties或application.yml中添加以下配置 ```properties # xxl-job admin address list, such as "http://address" or "http://address01,http://address02" xxl.job.admin.addresses=http://localhost:8080/xxl-job-admin # xxl-job executor config xxl.job.executor.appname=xxl-job-executor-sample xxl.job.executor.address=http://localhost:9999/xxl-job-executor xxl.job.executor.ip= xxl.job.executor.port=9999 xxl.job.accessToken= xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler xxl.job.executor.logretentiondays=30 ``` 其中xxl.job.admin.addresses为admin的地址,xxl.job.executor.address为executor的地址,xxl.job.executor.appname为executor的名称,其他根据实际情况进行修改。 3.编写JobHandler:编写一个类继承IJobHandler接口,并实现execute方法。例如: ```java @Component public class MyJobHandler extends IJobHandler { @Override public ReturnT<String> execute(String s) throws Exception { // do something return ReturnT.SUCCESS; } } ``` 4.在注解中添加handler:在需要执行的方法上添加@XxlJob注解,并指定handler名称。例如: ```java @Component public class MyJob { @XxlJob("myJobHandler") public void myJobHandler() { // do something } } ``` 5.启动项目:启动SpringBoot项目后,在admin界面中添加任务并启动即可。 以上就是整合SpringBootXxl-Job的完整步骤记录
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值