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