netty在启动后会阻塞后续的服务启动如下。
@Slf4j
@Component
public class InitServer implements CommandLineRunner {
@Autowired
private HeartBeatNettyServer heartBeatNettyServer;
@Autowired
private ReceiveNettyServer receiveNettyServer;
@Override
public void run(String... args) throws Exception {
log.info("接收相机返回拍照数据服务启动中。。。");
receiveNettyServer.start();
log.info("检测相机心跳服务启动中。。。");
heartBeatNettyServer.start();
}
}
用线程池启动