xxlJob项目链接

    1. /**
    2. * @author by itheima
    3. * @Date 2022/6/7
    4. * @Description 配置xxljob的配置类
    5. */
    6. //@Configuration
    7. public class XxlJobConfig {
    8. @Value("${xxl.job.admin.addresses}")
    9. private String adminAddresses;
    10. @Value("${xxl.job.accessToken}")
    11. private String accessToken;
    12. @Value("${xxl.job.executor.appname}")
    13. private String appname;
    14. @Value("${xxl.job.executor.address}")
    15. private String address;
    16. @Value("${xxl.job.executor.ip}")
    17. private String ip;
    18. @Value("${xxl.job.executor.port}")
    19. private int port;
    20. @Value("${xxl.job.executor.logpath}")
    21. private String logPath;
    22. @Value("${xxl.job.executor.logretentiondays}")
    23. private int logRetentionDays;
    24. /**
    25. * 配置xxljob集成spring的任务执行器
    26. * @return
    27. */
    28. @Bean
    29. public XxlJobSpringExecutor xxlJobExecutor() {
    30. XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
    31. xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
    32. xxlJobSpringExecutor.setAppname(appname);
    33. xxlJobSpringExecutor.setAddress(address);
    34. xxlJobSpringExecutor.setIp(ip);
    35. xxlJobSpringExecutor.setPort(port);
    36. xxlJobSpringExecutor.setAccessToken(accessToken);
    37. xxlJobSpringExecutor.setLogPath(logPath);
    38. xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
    39. return xxlJobSpringExecutor;
    40. }
    41. }