Spring Boot – Enable Debugging

Nearly everytime we get an Exception or a Bug the one major thing we all have to do, is debugging our code.
Okay maybe only the other programmers in our team have to do this, because our code is always free of bugs and is never doing some strange things 😉

Even if bugs can never happen to you, I´d like to show you how you can use the Debugger in your Spring Boot Application.

NetBeans Debugger Attaching

Every IDE handles the configuration of their Remote Debugger a bit different. I´ll show it to you in NetBeans.

In the Ribbon Bar on top of Netbeans, navigate to Debug -> Attach Debugger and a small Window will appear. Maybe it will be pre configured, just check the values that they will look like the following example:

Start the Debugging

Now open the Command Line Interface navigate to your project, and type:

mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

During the run of your console, the printing text will stop and waits for a Debugger that listens to the port 5005.

Switch back to NetBeans and press the OK Button. (If you haven´t done already)

The CLI will now continue and boots your application within debug mode.


Thanks for reading and have fun debugging your Spring Boot Application.

Feel free to share

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.