一、准备条件。

1、springboot程序以debug方式启动。

2、配置eclipse remote debug参数。

二、debug方式启动java application

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9011 -Djava.net.preferIPv4Stack=true -jar xxxx1.0.jar

其中address=9011为端口号。

suspend=n表示不等待调试程序直接启动。=y表示等待eclipse调试接入后才启动。

三、配置eclipse remote debug参数。

eclipse远程调试之springboot

在弹出的图中找到“Remote Java Application”,并右键“new”,然后按照如下配置。

eclipse远程调试之springboot

apply之后执行Debug即可。按此方式进行调试的程序,无法将服务端LOG输出到本地,为此方法的弊端,如有更好的方法,请各位留言。

相关文章: