package com.ld.igds.protocol.iot;
|
|
import com.ld.igds.data.ConfigData;
|
import com.ld.igds.protocol.iot.height.server.IotServerEngine;
|
import com.ld.igds.protocol.iot.n2.fzzy.server.N2FzzyServerEngine;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.core.annotation.Order;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 可以根据配置文件灵活调整
|
* 配置随系统自动启动服务 -- 执行顺序20-29
|
*/
|
@Component(ServerRunner.BEAN_ID)
|
@Order(value = 23)
|
public class ServerRunner implements CommandLineRunner {
|
|
public static final String BEAN_ID = "iot.serverRunner";
|
|
@Autowired
|
private ConfigData configData;
|
@Autowired
|
private IotServerEngine iotServerEngine;
|
@Autowired
|
private N2FzzyServerEngine fzzyServerEngine;
|
|
@Override
|
public void run(String... strings) throws Exception {
|
|
if ("dev".equals(configData.getActive())) {
|
iotServerEngine.start(IotServerEngine.PORT);
|
fzzyServerEngine.start(9307);
|
return;
|
}
|
|
if (configData.getActive().indexOf("pro") >= 0) {
|
iotServerEngine.start(IotServerEngine.PORT);
|
fzzyServerEngine.start(9307);
|
}
|
}
|
}
|