Macbook Pro  • • •  Sleep Deprivation       all posts in Archive

Debug SpringBoot with Gradle in Eclipse

There’re 2 ways to debug SpringBoot Application in Eclipse.

1st way, Run SpringBoot Application in Eclipse

This is most easy and natural way in Eclipse, you need use:

  • Spring version Eclipse : STS
  • or Standard Eclipse installed Spring Tools from Eclipse Marketplace

Then just need configure in Run -> Debug Confugrations -> Spring Boot App

debug-springboot-run-in-eclipse

2nd way, Run SpringBoot Application in Shell

2.1 Run SpringBoot with –debug-jvm

Run Spring-boot with –debug-jvm , Gradle will start with remote debug mode.

➜  XXX-springboot-project-folder git:(master) ✗ gradle bootRun --debug-jvm

> Task :XXX-springboot-project:bootRun
Listening for transport dt_socket at address: 5005
<============-> 93% EXECUTING [1m 1s]
> :XXX-springboot-project:bootRun

From the Shell, you will see Gradle is waiting for connection to remote debug on port 5005.

2.2 Configure Eclipse Remote Debugging

Configure with Project -> Debug as… -> Debug Configuration -> Remote Java Application. As host set localhost, and port 5005.

debug-springboot-run-in-shell

After click DEBUG button, debugging mode will attach to 5005, and Gradle will continue to launch application.