Maven Central
Add one starter.
The dependency includes Spring MVC instrumentation and configuration metadata. Java 17 or newer is required.
<dependency>
<groupId>com.apirelio</groupId>
<artifactId>apirelio-spring-boot-starter</artifactId>
<version>0.2.0</version>
</dependency>Auto-configuration
Set project properties.
Adding the starter registers the filter and graceful shutdown hook. No manual servlet registration is required.
apirelio:
api-key: ${APIRELIO_API_KEY}
endpoint: ${APIRELIO_ENDPOINT:https://apirelio.com}
service: billing-api
environment: production
release: ${GIT_COMMIT:unknown}
include-routes: [/api/**]
exclude-routes: [/api/health]
metadata-keys: [region]
capture-headers: [x-sdk-version, user-agent]B2B context
Resolve a stable customer.
Expose a CustomerResolver bean after your authentication layer. Prefer stable internal IDs and omit personal data.
@Configuration
class ApirelioIdentityConfiguration {
@Bean
CustomerResolver apirelioCustomers() {
return request -> {
Account account = (Account) request.getAttribute("account");
return account == null ? null : new ApirelioCustomer(
account.getId().toString(),
account.getName(),
account.getPlan());
};
}
}Optional context
Add applications and allow-listed metadata.
Resolver failures are isolated from the response. Metadata accepts only configured scalar keys and remains bounded to 20 entries and 4 KiB.
@Bean
ApplicationResolver apirelioApplications() {
return request -> new ApirelioApplication(
request.getHeader("X-Application-Id"));
}
@Bean
MetadataResolver apirelioMetadata() {
return request -> Map.of("region", "eu-central");
}Request lifecycle
Resolved routes, asynchronous delivery.
The filter records Spring's matched route pattern after controller handling. Capture only enqueues; a bounded daemon worker batches, retries transient failures and flushes during shutdown.
Bodies, query strings, credentials, cookies, email addresses and client IP addresses are never included. Sensitive metadata keys are rejected even when configured.