我在springboot项目中使用CommandLineRunner启动netty时,只能启动3个netty服务端,第四个就启动不了了
/**
* 启动程序
*
* @author rcms
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RcmsApplication implements CommandLineRunner {
@Resource
private NettyServer nettyServer;
@Autowired
private WindNettyServer windNettyServer;
@Autowired
private GkWindNettyServer gkWindNettyServer;
@Autowired
private TbWindNettyServer tbWindNettyServer;
public static void main(String[] args) {
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RcmsApplication.class, args);
System.out.println("RCMS启动成功");
}
@Override
public void run(String... args) throws Exception {
// TODO Auto-generated method stub
CompletableFuture.runAsync(() -> nettyServer.init(Integer.parseInt(rcmsConfig.getTcpPort())));
CompletableFuture.runAsync(() -> windNettyServer.init(Integer.parseInt(rcmsConfig.getWindTcpPort())));
CompletableFuture.runAsync(() -> gkWindNettyServer.init(Integer.parseInt(rcmsConfig.getGkWindTcpPort())));
CompletableFuture.runAsync(() -> tbWindNettyServer.init(Integer.parseInt(rcmsConfig.getTbWindTcpPort())));//这个就无法启动了
}
}