Commit 866d6beb authored by Node- 门 忠鑫's avatar Node- 门 忠鑫

# 添加@lazy注解

parent c5c22976
......@@ -2,6 +2,7 @@ package cn.quantgroup.tech.enoch.agent;
import cn.quantgroup.tech.enoch.agent.report.IReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
......@@ -10,6 +11,7 @@ import org.springframework.stereotype.Component;
* @author: amen
* @date: 2019-02-26
*/
@Lazy
@Component
@EnableScheduling
public class AgentReportTask {
......@@ -32,4 +34,5 @@ public class AgentReportTask {
public void report() {
reportService.report();
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@ package cn.quantgroup.tech.enoch.agent.configuration;
import cn.quantgroup.tech.enoch.agent.AgentReportTask;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
......@@ -17,6 +17,7 @@ import org.springframework.kafka.core.ProducerFactory;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
......@@ -26,13 +27,17 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
*/
@Slf4j
@Configuration
@ComponentScan(basePackageClasses = {AgentReportTask.class})
@ComponentScan(basePackageClasses = AgentReportTask.class)
@EnableConfigurationProperties(EnochAgentProperties.class)
@ConditionalOnProperty(prefix = "tech.enoch", name = "enabled", havingValue = "true")
public class EnochAgentAutoConfiguration {
@Autowired
private EnochAgentProperties enochAgentProperties;
@Autowired
private AgentReportTask agentReportTask;
@Bean
public ProducerFactory<String, String> producerFactory() {
HashMap<String, Object> config = new HashMap<>(16);
......
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