package com.dy.pipirrComCreator; import com.dy.pipirrComCreator.console.CommandConsole; import org.springframework.stereotype.Component; import java.io.Console; /** * @Author: liurunyu * @Date: 2025/5/6 18:02 * @Description */ @Component public class Server { public void startServer() throws Exception{ Console console = System.console(); if (console == null) { throw new Exception("严重错误,未能得到控制台对象!"); } CommandConsole mwConsole = new CommandConsole(console) ; mwConsole.init(); boolean exit = mwConsole.clientConsole() ; if(exit){ System.exit(-1); } } }