What’s New in Spring Boot 3.5? 13 Must‑Know Features for Java Backend Developers
Spring Boot 3.5 introduces a suite of enhancements—including task decorator support, the Vibur connection pool, SSL health metrics, flexible configuration loading, automatic Trace‑ID headers, richer Actuator capabilities, functional programming hooks, and many more—each explained with code examples and practical usage tips for modern Java backend development.
Spring Boot 3.5 is scheduled for release this month, bringing a range of notable improvements for Java backend developers.
Task scheduling enhancement : TaskDecorator optimizes scheduled tasks.
Vibur connection pool : A high‑performance database connection option.
Security monitoring upgrade : SSL certificate status is clearly visible.
Configuration management optimization : More flexible handling of environment variables and configurations.
Link tracing improvement : Trace ID is automatically written to HTTP response headers.
Actuator experience boost : Comprehensive enhancements to Actuator functionality.
Functional programming support : Early access to Spring Framework 7 features.
New Features Details
1. TaskDecorator: More Powerful Scheduled Tasks
Spring Boot 3.5 automatically applies a TaskDecorator bean from the application context to all scheduled task executors.
<code>@Bean
public TaskDecorator myTaskDecorator() {
return taskDecorator -> {
// Retrieve main‑thread context information
String userId = UserContext.getCurrentUserId();
// Return the wrapped task
return () -> {
// Set context in the child thread
...
};
};
}
</code>This eliminates boiler‑plate code and makes passing security context and MDC log information trivial, especially for multi‑tenant or unified permission scenarios.
2. Vibur Connection Pool: A New Performance‑Optimized Choice
In addition to HikariCP, Tomcat, DBCP2 and OracleUcp, Spring Boot 3.5 adds support for the Vibur DBCP connection pool.
<code>spring:
datasource:
type: io.vibur.dbcp.ViburDBCPDataSource
</code>Vibur DBCP offers advanced performance monitoring, slow‑SQL detection, thread‑hunger prevention, and JDBC statement caching, making it suitable for applications with stringent database performance requirements.
3. SSL Bundle Metrics: Clear Security Monitoring
Actuator now provides health metrics for SSL certificate chains, categorising them as valid, expired, about‑to‑expire, or not‑yet‑valid.
<code>management:
endpoints:
web:
exposure:
include: health,info,ssl
ssl:
bundles:
enabled: true
</code>Operations teams can monitor SSL status in real time and avoid service interruptions caused by expired certificates.
4. Environment Variable Config Loading: Easier Multi‑Environment Deployment
Spring Boot 3.5 allows loading multiple configuration properties from a single environment variable, simplifying containerised deployments.
<code># In application.yml
spring:
config:
import: env:MY_CONFIGURATION
# Set environment variable
MY_CONFIGURATION='datasource.url=jdbc:mysql://prod-db:3306/myapp
datasource.username=prod_user
datasource.password=prod_password'
</code>This approach reduces the need for numerous individual environment variables in Docker and Kubernetes setups.
5. Actuator‑Triggered Quartz Jobs: Smarter Operations
Quartz jobs can now be triggered via an HTTP endpoint, eliminating the need to wait for a scheduled time.
<code># Trigger a specific Quartz job
curl -X POST http://localhost:8080/actuator/quartz/jobs/DEFAULT/syncDataJob
</code>Operators can manually start tasks with a simple request, greatly improving response speed in urgent situations.
6. HTTP Response Header Trace ID: Seamless Distributed Tracing
When integrated with Micrometer Observations and Tracing, Spring Boot automatically writes the Trace ID to HTTP response headers.
<code>management:
observations:
http:
server:
requests:
write-trace-header: true
</code>This enables front‑end services to capture the Trace ID for reporting, enhancing end‑to‑end fault diagnosis.
7. Structured Log Stacktrace Customisation
Spring Boot 3.5 allows customisation of stack‑trace output in structured JSON logs.
<code>logging:
structured:
json:
stacktrace:
max-depth: 20
packaged-only: true
include-packages: com.mycompany
exclude-packages: org.springframework,java.lang
</code>Only business‑code stack frames are emitted, making logs clearer and issue localisation more precise.
8. WebMvc Functional Routing Information
The Mappings endpoint now includes detailed information about WebMvc.fn functional routes.
<code>@Bean
public RouterFunction<ServerResponse> routerFunction() {
return route()
.GET("/api/users", this::getAllUsers)
.POST("/api/users", this::createUser)
.build();
}
</code>9. Service Connection SSL Support
Client‑side SSL support has been added for various services such as Cassandra, Couchbase, Elasticsearch, Kafka, MongoDB, RabbitMQ, and Redis.
<code>spring:
data:
mongodb:
ssl:
enabled: true
bundle: mongodb-bundle
ssl:
bundles:
mongodb-bundle:
keystore:
location: classpath:mongodb-keystore.p12
password: secret
type: PKCS12
</code>This simplifies secure communication configuration for backend services.
10. OpenTelemetry Improvements
Configuration properties and environment variables can now set OpenTelemetry resource attributes, including support for
service.namespace.
<code>management:
tracing:
opentelemetry:
resource:
attributes:
service.name: my-service
service.namespace: my-group
export:
otlp:
endpoint: http://tempo:4317
</code>11. Spring Batch Enhancements
Custom
JobParametersConvertercan be defined and transaction‑state validation can be controlled.
<code>@Bean
public JobParametersConverter customJobParametersConverter() {
return new MyCustomJobParametersConverter();
}
spring:
batch:
jdbc:
validate-transaction-state: false
</code>12. OAuth 2.0 JWT Profile: Standardised Authentication
Spring Security 6.5.0 adds support for RFC 9068, standardising the JWT format of OAuth 2.0 access tokens.
<code>@Bean
public JwtEncoder jwtEncoder() {
return new NimbusJwtEncoder(jwkSource());
}
@Bean
public OAuth2TokenCustomizer<JwtEncodingContext> jwtCustomizer() {
return context -> {
JwtClaimsSet.Builder claims = context.getClaims();
claims.claim("client_id", context.getRegisteredClient().getClientId());
// Additional RFC 9068 claims
};
}
</code>13. Functional Bean Registration: Preview Spring 7 Features
The
BeanRegistrarinterface enables functional bean registration, offering a more flexible alternative to
@Conditionalfor dynamic bean creation.
<code>public class MyBeanRegistrar implements BeanRegistrar {
@Override
public void registerBeans(BeanRegistry registry, Environment environment) {
// Dynamically register beans based on conditions
if (environment.containsProperty("feature.enabled")) {
registry.registerBean(MyService.class, MyService::new);
}
}
}
@Import(MyBeanRegistrar.class)
@Configuration
public class AppConfig {
// ...
}
</code>macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
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.