Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
commons
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DevOps
commons
Commits
866d6beb
Commit
866d6beb
authored
Mar 01, 2019
by
Node- 门 忠鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# 添加@lazy注解
parent
c5c22976
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
AgentReportTask.java
.../java/cn/quantgroup/tech/enoch/agent/AgentReportTask.java
+3
-0
EnochAgentAutoConfiguration.java
...noch/agent/configuration/EnochAgentAutoConfiguration.java
+7
-2
No files found.
enoch-agent-spring-boot-starter/src/main/java/cn/quantgroup/tech/enoch/agent/AgentReportTask.java
View file @
866d6beb
...
@@ -2,6 +2,7 @@ package cn.quantgroup.tech.enoch.agent;
...
@@ -2,6 +2,7 @@ package cn.quantgroup.tech.enoch.agent;
import
cn.quantgroup.tech.enoch.agent.report.IReportService
;
import
cn.quantgroup.tech.enoch.agent.report.IReportService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -10,6 +11,7 @@ import org.springframework.stereotype.Component;
...
@@ -10,6 +11,7 @@ import org.springframework.stereotype.Component;
* @author: amen
* @author: amen
* @date: 2019-02-26
* @date: 2019-02-26
*/
*/
@Lazy
@Component
@Component
@EnableScheduling
@EnableScheduling
public
class
AgentReportTask
{
public
class
AgentReportTask
{
...
@@ -32,4 +34,5 @@ public class AgentReportTask {
...
@@ -32,4 +34,5 @@ public class AgentReportTask {
public
void
report
()
{
public
void
report
()
{
reportService
.
report
();
reportService
.
report
();
}
}
}
}
\ No newline at end of file
enoch-agent-spring-boot-starter/src/main/java/cn/quantgroup/tech/enoch/agent/configuration/EnochAgentAutoConfiguration.java
View file @
866d6beb
...
@@ -2,11 +2,11 @@ package cn.quantgroup.tech.enoch.agent.configuration;
...
@@ -2,11 +2,11 @@ package cn.quantgroup.tech.enoch.agent.configuration;
import
cn.quantgroup.tech.enoch.agent.AgentReportTask
;
import
cn.quantgroup.tech.enoch.agent.AgentReportTask
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.kafka.clients.producer.ProducerConfig
;
import
org.apache.kafka.clients.producer.ProducerConfig
;
import
org.apache.kafka.common.serialization.StringSerializer
;
import
org.apache.kafka.common.serialization.StringSerializer
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
...
@@ -17,6 +17,7 @@ import org.springframework.kafka.core.ProducerFactory;
...
@@ -17,6 +17,7 @@ import org.springframework.kafka.core.ProducerFactory;
import
org.springframework.scheduling.annotation.SchedulingConfigurer
;
import
org.springframework.scheduling.annotation.SchedulingConfigurer
;
import
org.springframework.scheduling.config.ScheduledTaskRegistrar
;
import
org.springframework.scheduling.config.ScheduledTaskRegistrar
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.concurrent.ScheduledThreadPoolExecutor
;
import
java.util.concurrent.ScheduledThreadPoolExecutor
;
...
@@ -26,13 +27,17 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
...
@@ -26,13 +27,17 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
*/
*/
@Slf4j
@Slf4j
@Configuration
@Configuration
@ComponentScan
(
basePackageClasses
=
{
AgentReportTask
.
class
}
)
@ComponentScan
(
basePackageClasses
=
AgentReportTask
.
class
)
@EnableConfigurationProperties
(
EnochAgentProperties
.
class
)
@EnableConfigurationProperties
(
EnochAgentProperties
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.enoch"
,
name
=
"enabled"
,
havingValue
=
"true"
)
public
class
EnochAgentAutoConfiguration
{
public
class
EnochAgentAutoConfiguration
{
@Autowired
@Autowired
private
EnochAgentProperties
enochAgentProperties
;
private
EnochAgentProperties
enochAgentProperties
;
@Autowired
private
AgentReportTask
agentReportTask
;
@Bean
@Bean
public
ProducerFactory
<
String
,
String
>
producerFactory
()
{
public
ProducerFactory
<
String
,
String
>
producerFactory
()
{
HashMap
<
String
,
Object
>
config
=
new
HashMap
<>(
16
);
HashMap
<
String
,
Object
>
config
=
new
HashMap
<>(
16
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment