|
|
@@ -0,0 +1,30 @@
|
|
|
+package com.izouma.nineth.config;
|
|
|
+
|
|
|
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+
|
|
|
+@EnableConfigurationProperties(XxlJobProperties.class)
|
|
|
+@Configuration
|
|
|
+@AllArgsConstructor
|
|
|
+public class XxlJobConfig {
|
|
|
+
|
|
|
+ private final XxlJobProperties properties;
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public XxlJobSpringExecutor xxlJobExecutor() {
|
|
|
+ XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
|
|
+ xxlJobSpringExecutor.setAdminAddresses(properties.getAdminAddresses());
|
|
|
+ xxlJobSpringExecutor.setAppname(properties.getAppName());
|
|
|
+ xxlJobSpringExecutor.setAddress(properties.getAddress());
|
|
|
+ xxlJobSpringExecutor.setIp(properties.getIp());
|
|
|
+ xxlJobSpringExecutor.setPort(properties.getPort());
|
|
|
+ xxlJobSpringExecutor.setAccessToken(properties.getAccessToken());
|
|
|
+ xxlJobSpringExecutor.setLogPath(properties.getLogPath());
|
|
|
+ xxlJobSpringExecutor.setLogRetentionDays(properties.getLogRetentionDays());
|
|
|
+
|
|
|
+ return xxlJobSpringExecutor;
|
|
|
+ }
|
|
|
+}
|