36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
|
|
package com.m2pool.lease;
|
||
|
|
|
||
|
|
|
||
|
|
import com.m2pool.lease.annotation.EnableCustomSwagger2;
|
||
|
|
import com.m2pool.lease.netty.server.NettyTcpServer;
|
||
|
|
import io.netty.channel.ChannelFuture;
|
||
|
|
import org.mybatis.spring.annotation.MapperScan;
|
||
|
|
import org.springframework.boot.CommandLineRunner;
|
||
|
|
import org.springframework.boot.SpringApplication;
|
||
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
|
||
|
|
@EnableCustomSwagger2
|
||
|
|
@SpringBootApplication
|
||
|
|
@MapperScan({"com.m2pool.lease.mapper"})
|
||
|
|
public class LeaseApplication implements CommandLineRunner {
|
||
|
|
|
||
|
|
public static void main(String[] args) {
|
||
|
|
SpringApplication.run(LeaseApplication.class, args);
|
||
|
|
System.out.println("运算力平台启动成功");
|
||
|
|
}
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
NettyTcpServer nettyTcpServer;
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void run(String... args) {
|
||
|
|
//启动服务端
|
||
|
|
ChannelFuture start = nettyTcpServer.start();
|
||
|
|
//服务端管道关闭的监听器并同步阻塞,直到channel关闭,线程才会往下执行,结束进程
|
||
|
|
start.channel().closeFuture().syncUninterruptibly();
|
||
|
|
}
|
||
|
|
}
|