Accepted answer

why don't you just right click on the main() method and choose "debug as... java application"?


right click on the spring boot applications main class file -> select debug as options -> select java application

enter image description here now you can use breakpoints to debug the application.


please see to enable the remote debugging. if you are using tomcat to run your application, start tomcat with remote debug parameters or you can start tomcat with jpda support by using following command.


<tomcat bin dir>/startup.bat jpda


<tomcat bin dir>/ jpda

this will enable remote debugging on port 8000


with eclipse or any other ide, just right click on your main spring boot application and click "debug as java application"


this question is already answered, but i also got same issue to debug springboot + gradle + jhipster,

mostly spring boot application can debug by right click and debug, but when you use gradle, having some additional environment parameter setup then it is not possible to debug directly.

to resolve this, eclipse provided one additional features as remote java application

by using this features you can debug your application.

follow below step:

run your gradle application with ./gradlew bootrun --debug-jvm command

now go to eclipse --> right click project and debug configuration --> remote java application.

add you host and port as localhost and port as 5005 (default for gradle debug, you can change it)

refer for more detail and step.


right click on the spring boot project -> debug as -> spring boot app. put a debugger point and invoke the app from a client like postman


  • right click on your project and choose "debug as => java application or spring boot app" -capture1 - enter image description here
  • if you want that your application pause in somewhere in your app double click on the left you will have like this capture 2. enter image description here
  • then when you start your app use those arrows to go next.(capture 3) enter image description here


the best solution in my opinion is add a plugin in the pom.xml, and you don't need to do anything else all the time:

                        -xdebug -xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9898


run below command where pom.xml is placed:

mvn spring-boot:run -drun.jvmarguments="-xdebug -xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

and start your remote java application with debugging option on port 5005


i didn't need to set up remote debugging in order to get this working, i used maven.

  1. ensure you have the maven plugin installed into eclipse.
  2. click run > run configurations > maven build > new launch configuration:
    • base directory: browse to the root of your project
    • goals: spring-boot::run.
  3. click apply then click run.

nb. if your ide has problems finding your project's source code when doing line-by-line debugging, take a look at this so answer to find out how to manually attach your source code to the debug application.

hope this helps someone!


how to debug a remote staging or production spring boot application


let's assume you have successfully followed spring boot's guide on setting up your spring boot application as a service. your application artifact resides in /srv/my-app/my-app.war, accompanied by a configuration file /srv/my-app/my-app.conf:

# this is file my-app.conf
# what can you do in this .conf file? the my-app.war is prepended with a sysv init.d script
# (yes, take a look into the war file with a text editor). as my-app.war is symlinked in the init.d directory, that init.d script
# gets executed. one of its step is actually `source`ing this .conf file. therefore we can do anything in this .conf file that
# we can also do in a regular shell script.

export spring_profiles_active=staging

when you restart your spring boot application with sudo service my-app restart, then in its log file located at /var/log/my-app.log should be a line saying listening for transport dt_socket at address: 8002.

client-side (developer machine)

open an ssh port-forwarding tunnel to the server: ssh -l 8002:localhost:8002 keep this ssh session running.

in eclipse, from the toolbar, select run -> debug configurations -> select remote java application -> click the new button -> select as connection type standard (socket attach), as host localhost, and as port 8002 (or whatever you have configured in the steps before). click apply and then debug.

the eclipse debugger should now connect to the remote server. switching to the debug perspective should show the connected jvm and its threads. breakpoints should fire as soon as they are remotely triggered.


easier solution:

instead of typing mvn spring-boot:run, simply type mvndebug spring-boot:run

you will still need to attach the debugger in eclipse by making a new debug configuration for a "remote java application" on the relevant port.


there's section 19.2 in spring boot reference that tells you about starting your application with remote debugging support enabled.

$ java -xdebug -xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n \
   -jar target/myproject-0.0.1-snapshot.jar

after you start your application just add that remote java application configuration in run/debug configurations, select the port/address you defined when starting your app, and then you are free to debug.

Related Query