Commit c86ff641 authored by 郑航's avatar 郑航

修改elasticjob注解 支持动态注入配置

parent 0b77110d
package cn.quantgroup.tech.elastic.job.lite.autoconfigure;
import cn.quantgroup.tech.elastic.job.lite.annotation.ElasticSimpleJob;
import cn.quantgroup.tech.elastic.job.lite.listener.AddTraceListener;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
......@@ -45,7 +44,6 @@ public class ElasticJobAutoConfiguration {
regCenter.init();
Map<String, SimpleJob> map = applicationContext.getBeansOfType(SimpleJob.class);
AddTraceListener addTraceListener = new AddTraceListener();;
for (Map.Entry<String, SimpleJob> entry : map.entrySet()) {
SimpleJob simpleJob = entry.getValue();
ElasticSimpleJob elasticSimpleJobAnnotation = AopUtils.getTargetClass(simpleJob).getAnnotation(ElasticSimpleJob.class);
......@@ -62,10 +60,10 @@ public class ElasticJobAutoConfiguration {
DataSource dataSource = (DataSource) applicationContext.getBean(dataSourceRef);
JobEventRdbConfiguration jobEventRdbConfiguration = new JobEventRdbConfiguration(dataSource);
SpringJobScheduler jobScheduler = new SpringJobScheduler(simpleJob, regCenter, liteJobConfiguration, jobEventRdbConfiguration,addTraceListener);
SpringJobScheduler jobScheduler = new SpringJobScheduler(simpleJob, regCenter, liteJobConfiguration, jobEventRdbConfiguration);
jobScheduler.init();
} else {
SpringJobScheduler jobScheduler = new SpringJobScheduler(simpleJob, regCenter, liteJobConfiguration,addTraceListener);
SpringJobScheduler jobScheduler = new SpringJobScheduler(simpleJob, regCenter, liteJobConfiguration);
jobScheduler.init();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment