Spring Boot New Features and Best Practices for Developers 2025
This article will be an extended version of Spring Boot Best Practices for Developers, one of my most interesting articles. In this article, I walk through the latest Spring Boot features and some best practices that developers can integrate into modern applications.
Use virtual threads
Virtual threads, introduced in JDK 21 as part of Project Loom, are lightweight threads managed by the JVM rather than the OS, unlike traditional platform threads that map directly to native threads. Spring Boot 3.2+ provides integration with virtual threads via virtual thread executors, enabling developers to configure them seamlessly.
spring.threads.virtual.enabled=true
However, if you use a previous version of JDK other than 21, you may require additional configurations. Please note that virtual threads are suitable for blocking scenarios like IO operations (file reading, writing, API calling, DB connections), and you will not get any benefit in CPU-intensive operations.
Configurations with @ConfigurationProperties
Externalizing configuration details is one of the most important things when you develop applications. Because you can change settings and configurations without redeploying. In Spring Boot, you can use a properties file or a YAML file to add your configurations. So then you use the @Value annotation to inject properties. This is the common method we used.
@Value("${app.name}")
private String appName;
I prefer using the @ConfigurationProperties annotation to map your configuration details into an object. And then you can easily use it wherever you want.
Recommended by LinkedIn
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "demo-app-config")
@Data()
public class DemoAppConfig {
private String name;
private String version;
private String author;
}
Here is the application.yml file.
demoAppConfig:
name: DemoApp
version: 1.0v
author: John
Explore more latest features and best practices: Spring Boot New Features and Best Practices for Developers 2025
To deepen your understanding of Spring Boot, the following articles may prove valuable.