first commit

This commit is contained in:
2026-04-17 10:09:03 +08:00
commit 572ad1205f
325 changed files with 30209 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
package com.maibu;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.dtflys.forest.springboot.annotation.ForestScan;
import com.fastbee.netty.NettyServer;
import com.fastbee.websocket.WebsocketHandler;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
/**
* 启动程序
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DruidDataSourceAutoConfigure.class })
@ForestScan(basePackages = "com.maibu")
public class MiddlePlatformApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
ConfigurableApplicationContext context = SpringApplication.run(MiddlePlatformApplication.class, args);
WebsocketHandler websocketHandler = new WebsocketHandler(9002);
websocketHandler.start();
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
// 关闭WebSocket服务(核心:释放9002端口)
System.out.println("开始释放websocket资源");
try {
websocketHandler.stopServer();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// 关闭Spring上下文
context.close();
}, "shutdown-hook-thread"));
NettyServer nettyServer = context.getBean(NettyServer.class);
nettyServer.start();
}
}