feat(core):微服务节点SystemInit完成后再注册到注册中心

yun-zuoyi
汪云昊 5 years ago
parent 4606259e0b
commit 396d5b0fa3

@ -2,11 +2,10 @@ package cn.estsh.i3plus.core.apiservice.configuration;
import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService; import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
import cn.estsh.i3plus.platform.common.util.CommonConstWords; import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.impp.framework.boot.util.ImppSwitchUtil; import cn.estsh.impp.framework.boot.init.IAppStartSystemInit;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -17,26 +16,23 @@ import org.springframework.stereotype.Component;
* @Modify: * @Modify:
**/ **/
@Component @Component
public class AppStartSystemInit implements CommandLineRunner { public class AppStartSystemInit implements IAppStartSystemInit {
public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG); public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
@Autowired(required = false) @Autowired
private ISystemInitService systemInitService; private ISystemInitService systemInitService;
/**
*
*/
@Override @Override
public void run(String... args) throws Exception { public void systemInit() {
try { try {
if(ImppSwitchUtil.isUnitTestEnv()) {
LOGGER.info("【单元测试环境 跳过初始化...】");
return;
}
LOGGER.info("【IMPP-Core开始加载基础信息...】"); LOGGER.info("【IMPP-Core开始加载基础信息...】");
systemInitService.putAndLoadAll(); systemInitService.putAndLoadAll();
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

Loading…
Cancel
Save