Home/Documentation/Java/Spring Boot

Java / Spring Boot

Instrument Spring Boot APIs.

Capture matched MVC routes, customer context and final outcomes through one auto-configured, fail-safe starter.

Spring Boot 3.5–4.xSDK 0.2Production ready
01

Maven Central

Add one starter.

The dependency includes Spring MVC instrumentation and configuration metadata. Java 17 or newer is required.

pom.xmlxml
<dependency>
  <groupId>com.apirelio</groupId>
  <artifactId>apirelio-spring-boot-starter</artifactId>
  <version>0.2.0</version>
</dependency>
02

Auto-configuration

Set project properties.

Adding the starter registers the filter and graceful shutdown hook. No manual servlet registration is required.

application.ymlyaml
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]
03

B2B context

Resolve a stable customer.

Expose a CustomerResolver bean after your authentication layer. Prefer stable internal IDs and omit personal data.

Customer resolverjava
@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());
        };
    }
}
04

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.

Optional resolversjava
@Bean
ApplicationResolver apirelioApplications() {
    return request -> new ApirelioApplication(
            request.getHeader("X-Application-Id"));
}

@Bean
MetadataResolver apirelioMetadata() {
    return request -> Map.of("region", "eu-central");
}
05

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.

Privacy boundary

Bodies, query strings, credentials, cookies, email addresses and client IP addresses are never included. Sensitive metadata keys are rejected even when configured.