Commit 5949b4b3 authored by 技术部-任文超's avatar 技术部-任文超

解决平滑退出启动问题,依赖Apollo的local配置

parent 0e4693b2
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));
......
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
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