Warmupdicator Spring Boot Starter lets you define and run warm-up checks for HTTP endpoints, databases, or any custom resource, ensuring your app is ready for real traffic with minimal cold starts, and provides a dedicated Actuator health check for warm-up status.
Requirements: Java 17+ and Spring Boot 3.0+
Warmupdicator Spring Boot provides warmup monitoring support for Spring Boot Applications.
There are 2 ways to integrate warmupdicator-spring-boot in your project:
- Simply adding the starter jar
warmupdicator-spring-boot-starterto your classpath if using@SpringBootApplicationor@EnableAutoConfigurationwill enable warmup monitoring across the entire Spring Environment - Adding
warmupdicator-spring-bootto your classpath and adding@EnableWarmupdicatorto your main Configuration class to enable warmup monitoring across the entire Spring Environment
Simply add the starter jar dependency to your project if your Spring Boot application uses @SpringBootApplication or @EnableAutoConfiguration and warmup monitoring will be enabled across the entire Spring Environment (This means warmup checks will automatically run when the application starts):
<dependency>
<groupId>io.github.paxytools</groupId>
<artifactId>warmupdicator-spring-boot-starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>That's it! No additional configuration needed. Warmup monitoring will be automatically enabled.
If you don't use @SpringBootApplication or @EnableAutoConfiguration Auto Configuration annotations then add this dependency to your project:
<dependency>
<groupId>io.github.paxytools</groupId>
<artifactId>warmupdicator-spring-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>And then add @EnableWarmupdicator to your Configuration class. For instance:
@Configuration
@EnableWarmupdicator
public class MyApplication {
...
}And warmup monitoring will be enabled across the entire Spring Environment.
This will trigger some configuration to be loaded that basically does 4 things:
- It registers a Spring post processor that detects all beans implementing the
Warmupdicatorinterface - It creates
EndpointWarmupdicatorbeans for each endpoint defined in configuration properties - It defines a
WarmupServicethat executes all warmup indicators when the application starts - It registers a health indicator that reports the status of warmup checks
Add warmupdicator configuration to your application.yaml:
warmupdicator:
endpoint-warmer:
endpoints:
- url: http://localhost:8080/api/test
max-response-time: 500
- url: https://api.example.com/health
http-method: GET
max-response-time: 1000
ignore-failure: falseNote: For better separation, you can also use spring.config.imports or @PropertySource to load configuration from dedicated files like warmupdicator.yaml.
| Property | Default | Description |
|---|---|---|
warmupdicator.enabled |
true |
Enable/disable warmup checks |
warmupdicator.show-details |
false |
Show detailed information in health endpoint |
| Endpoint Warmer | ||
warmupdicator.endpoint-warmer.enabled |
true |
Enable endpoint warmup |
warmupdicator.endpoint-warmer.endpoints |
[] |
List of HTTP endpoints to check |
warmupdicator.endpoint-warmer.endpoints[].name |
Auto-generated | Unique identifier for this endpoint |
warmupdicator.endpoint-warmer.endpoints[].url |
Required | Full URL to call |
warmupdicator.endpoint-warmer.endpoints[].http-method |
GET |
HTTP method to use |
warmupdicator.endpoint-warmer.endpoints[].max-response-time |
500 |
Response time threshold in milliseconds |
warmupdicator.endpoint-warmer.endpoints[].expected-status |
Any 2xx | Expected HTTP status |
warmupdicator.endpoint-warmer.endpoints[].ignore-failure |
false |
Ignore failures and consider successful |
warmupdicator.endpoint-warmer.endpoints[].request-body |
null |
Request body for POST/PUT/PATCH requests |
warmupdicator.endpoint-warmer.endpoints[].headers |
null |
Custom HTTP headers as key-value pairs |
| DTO Warmer | ||
warmupdicator.dto-warmer.enabled |
false |
Enable DTO preloading warmup |
warmupdicator.dto-warmer.exclude-patterns |
["*Record", "*Immutable"] |
DTO class patterns to exclude from warmup |
warmupdicator.dto-warmer.warmup-serialization |
true |
Warm up Jackson serialization |
warmupdicator.dto-warmer.warmup-deserialization |
true |
Warm up Jackson deserialization |
Create custom warmup indicators by implementing the Warmupdicator interface. They must be annotated with @Component to be detected by Spring's component scanning:
@Component
public class DatabaseWarmupIndicator implements Warmupdicator {
@Override
public WarmupResult warmUp() {
// Perform your warmup check here
long startTime = System.currentTimeMillis();
// Your warmup logic...
try {
// Check database connectivity
boolean success = checkDatabaseConnection();
long responseTimeMs = System.currentTimeMillis() - startTime;
if (success) {
return WarmupResult.success(responseTimeMs);
} else {
return WarmupResult.failure("Database connection failed", responseTimeMs);
}
} catch (Exception e) {
long responseTimeMs = System.currentTimeMillis() - startTime;
return WarmupResult.failure("Database warmup error: " + e.getMessage(), responseTimeMs);
}
}
@Override
public String getId() {
return "database-connection";
}
private boolean checkDatabaseConnection() {
// Your database connection logic here
return true;
}
}Important: Custom warmup indicators must be annotated with @Component to be detected by Spring's component scanning.
Warmupdicator integrates seamlessly with Spring Boot Actuator by extending the built-in HealthIndicator system. This provides a standardized way to monitor warmup status alongside your application's other health checks.
Configure Spring Boot Actuator to expose health information:
management:
endpoints:
web:
exposure:
include: health
endpoint:
health:
show-details: alwaysCheck warmup status:
curl http://localhost:8080/actuator/healthThe health endpoint shows individual warmer results and overall status, making it easy to verify your application is fully warmed up and ready for traffic.
- Reduced First-Request Latency: Pre-warms Jackson serializers, HTTP clients, and custom components
- Early Failure Detection: Identifies connectivity and configuration issues during startup
- Health Monitoring: Integrates with Spring Boot Actuator for comprehensive health checks
- Simple Configuration: Minimal setup required - just add endpoints you want to warm up
- Flexible: Supports both HTTP endpoints and custom warmup logic
- Production Ready: Fail-safe design that never breaks application startup
- Startup Time: Adds minimal overhead (typically < 100ms for most applications)
- Memory Usage: Negligible memory footprint
- First Request: Can reduce first-request latency by 50-200ms depending on application complexity
- warmupdicator-spring-boot: Contains core API and Spring integration (Warmupdicator interface, WarmupResult class, beans)
- warmupdicator-spring-boot-starter: Spring Boot integration with auto-configuration
- warmupdicator-example: Example application demonstrating usage
See warmupdicator-example module for a complete example of how to use Warmupdicator in a Spring Boot application.
MIT License
Contributions are welcome! Please feel free to submit a Pull Request. For more information, please see the Contributing Guidelines.