NetBeans settings for smooth debugging Spring Boot Applications

Make NetBeans and Spring Boot Devtools play nice with each other
April 22, 2016 by Michael

Here’s a short tip for a smoother debugging experience using NetBeans for developing Spring Boot Applications while using the Spring Boot Devtools:

Make sure you include the Devtools inside your dependency management:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
</dependencies>

or

dependencies {
    compile("org.springframework.boot:spring-boot-devtools")
}

Devtools will automatically recognize that you’re running in an IDE respectively debugger and apart from a LiveReload server it’ll monitor your files and restart the context if necessary. To make this work you’ll to enable “Compile on save” in your NetBeans project (that is a project property) like this:


projectproperties

NetBeans however tries to apply all code changes in “Compile on save”-Mode. That works pretty well (not as good as JRebel, but then, NetBeans is free), but for example not for method deletions etc and you’ll end up with that error:


error-dialog

As you’re already opted to use Spring Boot Devtools, you won’t need that feature. The checkbox to turn it of is not a project specific setting but a global which you’ll find under the Java Debugger Tab inside Java options:


remove-apply-code

Turn “Apply code changes after save” of to enjoy a really smooth debugging and working on Spring Boot applications with NetBeans and Devtools.

No comments yet

Post a Comment

Your email is never published. We need your name and email address only for verifying a legitimate comment. For more information, a copy of your saved data or a request to delete any data under this address, please send a short notice to michael@simons.ac from the address you used to comment on this entry.
By entering and submitting a comment, wether with or without name or email address, you'll agree that all data you have entered including your IP address will be checked and stored for a limited time by Automattic Inc., 60 29th Street #343, San Francisco, CA 94110-4929, USA. only for the purpose of avoiding spam. You can deny further storage of your data by sending an email to support@wordpress.com, with subject “Deletion of Data stored by Akismet”.
Required fields are marked *