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 nor shared. Required fields are marked *