Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
598850b9
Commit
598850b9
authored
May 02, 2017
by
minminyan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在spring加载完毕后注册心跳包服务
parent
eb9cc7fc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
27 deletions
+14
-27
Bootstrap.java
src/main/java/cn/quantgroup/xyqb/Bootstrap.java
+14
-5
InitAndRegist.java
...in/java/cn/quantgroup/xyqb/config/init/InitAndRegist.java
+0
-22
No files found.
src/main/java/cn/quantgroup/xyqb/Bootstrap.java
View file @
598850b9
...
@@ -2,15 +2,17 @@ package cn.quantgroup.xyqb;
...
@@ -2,15 +2,17 @@ package cn.quantgroup.xyqb;
import
com.weibo.api.motan.common.MotanConstants
;
import
com.weibo.api.motan.common.MotanConstants
;
import
com.weibo.api.motan.util.MotanSwitcherUtil
;
import
com.weibo.api.motan.util.MotanSwitcherUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.
ConfigurableApplicationContext
;
import
org.springframework.context.
ApplicationListener
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.context.event.ContextRefreshedEvent
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
@ComponentScan
(
basePackages
=
{
"cn.quantgroup.xyqb"
,
"cn.quantgroup.cloudconfig"
})
@ComponentScan
(
basePackages
=
{
"cn.quantgroup.xyqb"
,
"cn.quantgroup.cloudconfig"
})
...
@@ -21,12 +23,19 @@ import org.springframework.scheduling.annotation.EnableAsync;
...
@@ -21,12 +23,19 @@ import org.springframework.scheduling.annotation.EnableAsync;
@Configuration
@Configuration
@EnableAspectJAutoProxy
@EnableAspectJAutoProxy
@EnableAsync
@EnableAsync
@Slf4j
public
class
Bootstrap
{
public
class
Bootstrap
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
ConfigurableApplicationContext
crt
=
SpringApplication
.
run
(
Bootstrap
.
class
,
args
);
SpringApplication
springApplication
=
new
SpringApplication
(
Bootstrap
.
class
);
springApplication
.
addListeners
(
new
ApplicationListener
<
ContextRefreshedEvent
>()
{
@Override
public
void
onApplicationEvent
(
ContextRefreshedEvent
event
)
{
MotanSwitcherUtil
.
setSwitcherValue
(
MotanConstants
.
REGISTRY_HEARTBEAT_SWITCHER
,
true
);
MotanSwitcherUtil
.
setSwitcherValue
(
MotanConstants
.
REGISTRY_HEARTBEAT_SWITCHER
,
true
);
// crt.registerShutdownHook();
log
.
info
(
"注册zookeeper成功"
);
System
.
out
.
println
(
"server start..."
);
}
});
springApplication
.
run
(
args
);
log
.
info
(
"server start..."
);
}
}
}
}
src/main/java/cn/quantgroup/xyqb/config/init/InitAndRegist.java
deleted
100644 → 0
View file @
eb9cc7fc
package
cn
.
quantgroup
.
xyqb
.
config
.
init
;
import
com.weibo.api.motan.common.MotanConstants
;
import
com.weibo.api.motan.util.MotanSwitcherUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
@Component
@Order
(
500
)
@Slf4j
public
class
InitAndRegist
implements
CommandLineRunner
{
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
MotanSwitcherUtil
.
setSwitcherValue
(
MotanConstants
.
REGISTRY_HEARTBEAT_SWITCHER
,
true
);
log
.
info
(
"注册成功"
);
//
// crt.registerShutdownHook();
}
}
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