JobTrackerAutoConfiguration.java
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.github.ltsopensource.spring.boot;
import com.github.ltsopensource.core.cluster.AbstractJobNode;
import com.github.ltsopensource.core.cluster.NodeType;
import com.github.ltsopensource.jobtracker.JobTracker;
import com.github.ltsopensource.jobtracker.JobTrackerBuilder;
import com.github.ltsopensource.spring.boot.annotation.EnableJobTracker;
import com.github.ltsopensource.spring.boot.properties.JobTrackerProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @author Robert HG (254963746@qq.com) on 4/9/16.
*/
@Configuration
@ConditionalOnBean(annotation = EnableJobTracker.class)
@EnableConfigurationProperties(JobTrackerProperties.class)
public class JobTrackerAutoConfiguration extends AbstractAutoConfiguration {
@Autowired(required = false)
private JobTrackerProperties properties;
private JobTracker jobTracker;
@Override
protected void initJobNode() {
jobTracker = JobTrackerBuilder.buildByProperties(properties);
}
@Override
protected NodeType nodeType() {
return NodeType.JOB_TRACKER;
}
@Override
protected AbstractJobNode getJobNode() {
return jobTracker;
}
}