> ## Documentation Index
> Fetch the complete documentation index at: https://repost.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Java Framework Integration

> Inject the Repost Java client with Spring Boot or Jakarta CDI, and wire the framework-neutral core into Quarkus, Micronaut, or Vert.x.

The container injects one shared `RepostRuntime`, and the plugin's `integration` selection registers your generated client as a bean. Spring Boot and Jakarta CDI are dedicated integrations; everything else uses the framework-neutral core.

## Spring Boot

Add `sh.repost:repost-client-spring-boot-starter` and set the plugin's `integration` to `SPRING_BOOT`. The starter contributes a single, container-managed `RepostRuntime` bean bound to `repost.client.*` properties, and the plugin's generated glue registers your client as an injectable bean:

```java theme={"languages":{"custom":["/languages/repost.json"]}}
@Service
class OrderEvents {
    private final RepostClient repost;

    OrderEvents(RepostClient repost) { // injected, backed by the shared runtime
        this.repost = repost;
    }
}
```

Configure with typed properties (relaxed-binding `REPOST_CLIENT_*` environment variables also work):

```yaml application.yml theme={"languages":{"custom":["/languages/repost.json"]}}
repost:
  client:
    api-key: ${REPOST_SEND_API_KEY}
    base-uri: https://api.repost.sh
    operation-timeout: 30s
    max-attempts: 4
    max-in-flight: 128
    max-buffered-bytes: 64MiB
```

The full key set is `enabled`, `api-key`, `base-uri`, `connect-timeout`, `attempt-timeout`, `operation-timeout`, `max-attempts`, `max-in-flight`, `max-buffered-bytes`, `retry-base-delay`, `retry-max-delay`, `user-agent-suffix`, and `observability.micrometer-enabled` / `observability.opentelemetry-enabled` under the `repost.client` prefix; an unknown key fails startup. Override the client by declaring a `ClientOptionsCustomizer` bean (applied to the builder), an `ApiKeyProvider` bean (takes precedence over `api-key`), or your own `RepostRuntime` bean (the starter backs off and does not close a runtime you own). The starter **closes** the runtime it created on context shutdown, exposes a health indicator and `repost.client.runtime.*` gauges, and auto-wires the Micrometer observer and OpenTelemetry telemetry when those bridges and a single registry/provider bean are present. Compiled against Spring Boot 4.0.7 and verified on 4.1.0 (JDK 17, 21, 25).

## Jakarta CDI and MicroProfile

Add `sh.repost:repost-client-cdi` and set `integration` to `CDI`. A build-compatible CDI extension registers an `@Singleton` `RepostRuntime`, configured from the identical `repost.client.*` MicroProfile Config keys, and the generated glue makes your client injectable:

```java theme={"languages":{"custom":["/languages/repost.json"]}}
@ApplicationScoped
class OrderEvents {
    @Inject RepostClient repost;
}
```

The same `ClientOptionsCustomizer` and `ApiKeyProvider` beans customize it; the extension disposes the runtime it owns when the scope ends and backs off when you supply your own `RepostRuntime`. Built against Jakarta CDI 4.0.1 and MicroProfile Config 3.1 — the CDI Lite / build-compatible extension model that WildFly, Open Liberty, and Payara support.

## Other frameworks

Quarkus and Micronaut are **not** yet dedicated integrations — dedicated extensions and native certification are post-GA — but the framework-neutral core works today. Produce the shared runtime and client as beans and wire close to the container's disposal hook:

<CodeGroup>
  ```java Quarkus (CDI producers) theme={"languages":{"custom":["/languages/repost.json"]}}
  @Produces
  @Singleton
  RepostRuntime runtime() {
      return RepostRuntime.create(ClientOptions.builder()
              .apiKey(System.getenv("REPOST_SEND_API_KEY"))
              .build());
  }

  void close(@Disposes RepostRuntime runtime) { runtime.close(); }

  @Produces
  @Singleton
  RepostClient client(RepostRuntime runtime) {
      return RepostClient.fromRuntime(runtime);
  }
  ```

  ```java Micronaut (@Factory) theme={"languages":{"custom":["/languages/repost.json"]}}
  @Factory
  class RepostFactory {
      @Bean(preDestroy = "close")
      @Singleton
      RepostRuntime runtime() {
          return RepostRuntime.create(ClientOptions.builder()
                  .apiKey(System.getenv("REPOST_SEND_API_KEY"))
                  .build());
      }

      @Singleton
      RepostClient client(RepostRuntime runtime) {
          return RepostClient.fromRuntime(runtime);
      }
  }
  ```
</CodeGroup>

`fromRuntime(...)` **borrows** the runtime — closing the client does not close the shared runtime, so the container's disposal of the `RepostRuntime` bean owns shutdown. One current Quarkus and one current Micronaut application pass this pattern in the release matrix. Vert.x (event-loop, via the `CompletionStage` API) is certified on 4.5.29 and 5.1.4.

## Continue

<Columns cols={3} className="gap-y-4">
  <Card title="Compatibility & security" icon="shield" href="/docs/send/java/compatibility" cta="Baseline" arrow="true">
    The supported JDK, framework, and build-tool matrix and the security posture.
  </Card>

  <Card title="Configuration" icon="sliders-horizontal" href="/docs/send/java/configuration" cta="Configure" arrow="true">
    The options behind the `repost.client.*` property keys.
  </Card>

  <Card title="Observability" icon="activity" href="/docs/send/java/observability" cta="Observe" arrow="true">
    The Micrometer and OpenTelemetry bridges the starter auto-wires.
  </Card>
</Columns>
