First, open Edit configurations, click on the icon to create a Remote application.
Fill in the name, configure the Host address (remote server address) and port (choose an unoccupied port). Then copy the parameters below For JDK1.4.x. The port configured in the example is 5005:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
After the above steps, the parameters for starting the remote server have been obtained. When starting springboot, the java command is used by default.
For example, the sample project startup command is:
java -jar test-tool.jar
Then add the parameters obtained above to the startup command:
java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 test-tool.jar
In this way, the server will listen on port 5005. You can check whether the monitoring is successful by using the following command:
netstat -anp | grep 5005
The above steps have completed the addition of server-side parameters. Next, start the Remote service just configured, namely test-tool-remote. At startup, we will find that this startup program only has debug startup mode.
After the startup is completed, put a breakpoint on the code that needs to be debugged. The remaining steps are to access the business request corresponding to the remote server, and debug will be synchronized locally. The rest of the operations are the same as local debugging, so I won’t go into details here.
The above is the detailed content of How to use Springboot to implement remote debugging in IDEA. For more information, please follow other related articles on the PHP Chinese website!