SpringBoot DevTools, Lombok, and Configuration Processor: A Quick Guide for Hot Deployment and Code Simplification
This article introduces how to enable SpringBoot DevTools for hot deployment, integrate Lombok to reduce boilerplate code, and use the Spring Configuration Processor for property binding hints, providing Maven dependencies, IDE settings, and example code snippets for Java backend development.
1. SpringBoot DevTools
SpringBoot DevTools is a tool that enables hot deployment for SpringBoot applications. It can be added by checking the option when creating a project or by adding the Maven dependency shown below.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>In IntelliJ IDEA press Ctrl+F9 after editing code to recompile; Eclipse recompiles automatically on save. To achieve automatic recompilation without manual trigger, enable the following settings in IDEA and modify the pom.xml as illustrated.
Step 1: Enable options in IDEA settings
Step 2: Place cursor after the <build> tag in pom.xml and press Alt+Shift+Ctrl+/
Step 3: Check the required options and restart IDEA
2. Lombok
Lombok simplifies JavaBean development by generating constructors, getters, and setters automatically.
You can enable Lombok by selecting the option during project initialization or by adding the following Maven dependency.
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>IDEA also requires the Lombok plugin, as shown in the screenshot.
Example usage:
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor // all-args constructor
@NoArgsConstructor // no-args constructor
@Data // getter + setter
public class User {
private Long id;
private String name;
private Integer age;
private String email;
}3. Spring Configuration Processor
The Spring Configuration Processor provides property‑binding hints for @ConfigurationProperties classes, though its benefit may be limited.
Example entity with @ConfigurationProperties:
package org.lzl.HelloWorld.entity;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "mypet")
public class Pet {
private String nickName;
private String strain;
// getters and setters omitted for brevity
@Override
public String toString() {
return "Pet [nickName=" + nickName + ", strain=" + strain + "]";
}
}To enable property suggestions in application.properties or application.yml , select the appropriate option when creating the SpringBoot project, or add the following Maven dependency and exclude it from the final jar to reduce size.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>Java Architect Essentials
Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.