Boost Spring Boot Productivity with DevTools, Lombok, and Config Processor
This guide shows how to enable hot‑deployment in Spring Boot using DevTools, simplify JavaBean code with Lombok, and add the Spring Configuration Processor for better property‑binding support, including Maven dependencies, IDE settings, and example snippets.
Spring Boot DevTools
Spring Boot DevTools is a tool that enables hot deployment for Spring Boot applications.
You can enable it either by selecting the option when creating a new project or by adding the following Maven dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>In IntelliJ IDEA, after modifying code press Ctrl+F9 to recompile and achieve hot‑deployment.
In Eclipse, simply saving the file ( Ctrl+S) triggers automatic compilation.
To enable automatic recompilation without manual shortcuts, configure the following settings in IDEA (see images):
Lombok
Lombok is a tool that simplifies JavaBean development by automatically generating constructors, getters, and setters.
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>After adding the dependency, install the Lombok plugin in IDEA (see image) and use Lombok annotations as shown:
@AllArgsConstructor // all‑args constructor
@NoArgsConstructor // no‑args constructor
@Data // generates getters, setters, toString, etc.
public class User {
private Long id;
private String name;
private Integer age;
private String email;
}Spring Configuration Processor
The Spring Configuration Processor provides metadata for @ConfigurationProperties classes, enabling IDE assistance for property binding.
Add the optional dependency to your project:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>To reduce the final JAR size, exclude the processor from the packaged artifact by adding the following configuration to the Maven build plugins:
<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>After adding the processor, annotate your POJOs with @ConfigurationProperties to enable property binding and IDE hints, for example:
@Component
@ConfigurationProperties(prefix = "mypet")
public class Pet {
private String nickName;
private String strain;
// getters and setters
}Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
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.
