https://www.xuxueli.com/xxl-job/ com.xuxueli xxl-job-core 2.3.0 import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;import lombok.extern.slf4j.Slf4j;import org.springframework.boot.context.properties.ConfigurationProperties;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.context.annotation.Profile;@Profile("xxl")@Slf4j@Configurationpublic class XxlJobConfig { @Bean @ConfigurationProperties(prefix = "xxl.job.executor") public XxlJobSpringExecutor xxlJobExecutor() { log.info("xxl-job executor init."); return new XxlJobSpringExecutor(); }}xxl: job: executor: admin-addresses: admin地址 access-token: appname: port: log-path: log-retention-days: 30import com.xxl.job.core.context.XxlJobHelper;import com.xxl.job.core.handler.annotation.XxlJob;import org.springframework.context.annotation.Profile;import org.springframework.stereotype.Component;@Profile("xxl")@Componentpublic class MyJob{ @XxlJob("JobHandler名称") public void execute() throws Exception { XxlJobHelper.log("success"); }}正常配置JobHandler
路由选后一个IP
记得开放防火墙端口
[root]#firewall-cmd --zone=public --add-port=端口/tcp --permanent[root]#firewall-cmd -reload | 留言与评论(共有 0 条评论) “” |