解决 SpringBoot启动后直接退出 Process finished with exit code 1

问题描述:

出现这个问题时,控制台没有任何输出,进程直接退出Process finished with exit code 1
在这里插入图片描述

解决办法:

使用 try catch 捕捉异常查看,发现还是没有任何日志

public static void main(String[] args) {
    
    
        try {
    
    
            SpringApplication.run(TestApplication.class, args);
        }catch (Exception e){
    
    
            e.printStackTrace();
        }
    }

但是作为踩坑无数的Java程序员,我们知道Exception还不是最顶级的异常类,于是换成Throwable

public static void main(String[] args) {
    
    
        try {
    
    
            SpringApplication.run(TestApplication.class, args);
        }catch (Throwable e){
    
    
            e.printStackTrace();
        }
    }

此时日志打印除了错误的内容,按照日志提示解决

猜你喜欢

转载自blog.csdn.net/qq_44732146/article/details/129714361