package com.changhong.epc.constter.system.run;
|
|
import com.changhong.epc.constter.system.SystemClients;
|
import com.iemsoft.framework.cloud.core.run.IEMApplication;
|
import com.iemsoft.framework.cloud.core.run.param.ParamInst;
|
import com.iemsoft.framework.cloud.core.tools.SpringUtil;
|
import com.iemsoft.framework.cloud.ribbon.ServerDefine;
|
import com.iemsoft.framework.cloud.ribbon.run.AppNameParamFilter;
|
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
import org.springframework.context.ConfigurableApplicationContext;
|
|
public class EpcApplication extends IEMApplication implements SystemClients{
|
|
private ServerDefine serverDefine;
|
|
public EpcApplication(ServerDefine serverDefine, Object... sources) {
|
super(sources);
|
this.serverDefine = serverDefine;
|
}
|
|
public ConfigurableApplicationContext run(String... args) {
|
try{
|
super.web(true);
|
return super.runStart(new AppNameParamFilter(new ParamInst(args), serverDefine).start());
|
}finally {
|
for(ServerDefine sd : REST_SERVERS){
|
SpringUtil.register(
|
sd.getBeanName()
|
, BeanDefinitionBuilder.genericBeanDefinition(EpcRestInterface.class)
|
.addConstructorArgValue(sd.getAppName())
|
.getRawBeanDefinition());
|
}
|
}
|
}
|
|
}
|