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
5949b4b3
Commit
5949b4b3
authored
Jan 11, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决平滑退出启动问题,依赖Apollo的local配置
parent
0e4693b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
5 deletions
+2
-5
Bootstrap.java
src/main/java/cn/quantgroup/xyqb/Bootstrap.java
+1
-4
app.properties
src/main/resources/META-INF/app.properties
+1
-1
No files found.
src/main/java/cn/quantgroup/xyqb/Bootstrap.java
View file @
5949b4b3
package
cn
.
quantgroup
.
xyqb
;
import
cn.quantgroup.tech.shutdown.DefaultSignalHandler
;
import
com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig
;
import
com.ctrip.framework.apollo.spring.config.ApolloPropertySourceInitializer
;
import
com.weibo.api.motan.common.MotanConstants
;
import
com.weibo.api.motan.util.MotanSwitcherUtil
;
...
...
@@ -16,7 +15,6 @@ import org.springframework.context.ConfigurableApplicationContext;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.context.event.ContextRefreshedEvent
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
sun.misc.Signal
;
...
...
@@ -25,7 +23,6 @@ import sun.misc.Signal;
@EnableAutoConfiguration
@SpringBootApplication
@EnableCaching
@EnableApolloConfig
(
value
={
"application"
,
"tech.msg.sdk"
,
"tech.sleuth"
,
"tech.common"
,
"tech.service.urls"
,
"cash.common"
})
@Configuration
@EnableAspectJAutoProxy
@EnableAsync
...
...
@@ -34,6 +31,7 @@ public class Bootstrap {
public
static
void
main
(
String
[]
args
)
{
SpringApplication
springApplication
=
new
SpringApplication
(
Bootstrap
.
class
);
springApplication
.
addInitializers
(
new
ApolloPropertySourceInitializer
(
"application"
,
"cash.common"
,
"tech.common"
,
"tech.msg.sdk"
,
"tech.sleuth"
,
"tech.service.urls"
));
springApplication
.
addListeners
(
new
ApplicationListener
<
ContextRefreshedEvent
>()
{
@Override
public
void
onApplicationEvent
(
ContextRefreshedEvent
event
)
{
...
...
@@ -43,7 +41,6 @@ public class Bootstrap {
});
springApplication
.
setRegisterShutdownHook
(
true
);
ConfigurableApplicationContext
run
=
springApplication
.
run
(
args
);
springApplication
.
run
(
args
);
log
.
info
(
"server start..."
);
// 启用平滑退出功能
Signal
.
handle
(
new
Signal
(
"INT"
),
new
DefaultSignalHandler
(
run
));
...
...
src/main/resources/META-INF/app.properties
View file @
5949b4b3
app.id
=
xyqb-user2
namespace
=
application,tech.msg.sdk,tech.sleuth,tech.common,tech.service.urls,cash.common
\ No newline at end of file
namespace
=
application,cash.common,tech.common,tech.msg.sdk,tech.sleuth,tech.service.urls
\ No newline at end of file
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