Quickstart by stack

Java Quickstart

Install the Java SDK from Maven Central, evaluate a flag with context, and register it with Spring Boot auto-configuration.

Prerequisites

  • Java 17 or later (Maven 3.9+ for build/test).
  • A server key (prefixed srv_) stored in environment configuration and not committed to source.
  • A flag key you can test in a non-production environment.
Install xml


  com.zenmanage
  zenmanage-java
  1.0.0

Initialize and evaluate java

import com.zenmanage.sdk.Zenmanage;
import com.zenmanage.sdk.config.Config;
import com.zenmanage.sdk.config.ConfigBuilder;

Config config = ConfigBuilder.create()
    .withEnvironmentToken(System.getenv("ZENMANAGE_SERVER_KEY"))
    .build();

Zenmanage zenmanage = new Zenmanage(config);

boolean enabled = zenmanage.flags()
    .single("new-dashboard", false)
    .isEnabled();

if (enabled) {
    System.out.println("Render the new dashboard");
}
Spring Boot auto-configuration java

# application.properties
# zenmanage.environment-token=srv_your_server_key_here
# zenmanage.cache-ttl-seconds=3600
# zenmanage.cache-backend=memory
# zenmanage.usage-reporting=true

import org.springframework.stereotype.Service;
import com.zenmanage.sdk.Zenmanage;

@Service
public class CheckoutService {
    private final Zenmanage zenmanage;

    public CheckoutService(Zenmanage zenmanage) {
        this.zenmanage = zenmanage;
    }

    public boolean newCheckoutEnabled() {
        return zenmanage.flags().single("new-checkout-flow", false).isEnabled();
    }
}
Error-handling pattern java

import com.zenmanage.sdk.errors.EvaluationException;
import com.zenmanage.sdk.errors.FetchRulesException;

try {
    double timeout = zenmanage.flags().single("api-timeout-ms").asNumber();
} catch (EvaluationException e) {
    System.out.println("flag not found: " + e.getMessage());
} catch (FetchRulesException e) {
    System.out.println("failed to fetch rules: " + e.getMessage());
}

// Or pass an inline default to avoid the exception entirely.
double timeout = zenmanage.flags().single("api-timeout-ms", 5000).asNumber();

Server-side only

The Java SDK requires a server token (prefixed srv_). Client and mobile keys are rejected at configuration time — use zenmanage-javascript or another browser or mobile SDK for those runtimes.

Spring Boot integration

Set zenmanage.* properties and the SDK auto-configures a Zenmanage bean ready to inject into any service or controller — no manual ConfigBuilder wiring required.

Next step

Take the next integration step in your own stack.

Start with the quickstart that matches your runtime, then return to the reference pages when you need exact request and payload details.

Language and framework names and logos shown above are trademarks or registered trademarks of their respective owners. Their use here is for identification purposes only and does not imply endorsement of, or affiliation with, Zenmanage.