Java Feature Flags

Split's Java SDK provides robust, scalable feature flag management, giving any team the power to safely launch features and target them to users.

Begin your free trial today.

Why use Split for Java feature flags?

Split’s Java SDK brings free, scalable feature flags to any app, website or experience built with in the Java language. Split helps teams control rollouts, and customer experiences, while gathering new data and insight on how their products are being engaged.

We focused on two things when building Split: simplicity and performance. Split is quick, secure and easy for anyone to use, especially when it comes to targeting releases or killing problem features. Using Split is the fastest way to start mitigating risk in your releases:

  • Release features to production but disabled for all users by default
  • Target new features only to internal QA teams
  • Slowly roll out features to a broader audience by percentage, demographic, geography, account type, or any other metric
  • Kill features with a single click to revert back to your safe state

Split works across many different languages, letting developers, PMs and support teams control feature rollout from one unified view—and monitor the success of any new code. Our integrations bring rollout updates into the tools your team is already using, further opening the feature-delivery process up to your entire organization.

Looking for Scala feature flag support?

Split’s Java SDK includes support for Scala, allowing customers with either environment to benefit from Split’s full controlled rollout capability without needing to do anything custom.

See how Main Street Hub uses Split in Java and Scala to make data-driven product decisions.

Qingqing Ouyang, SVP Engineering, Main Street Hub

Getting Started with Split for Java

Getting started with Split is easy—in the case of Java, you just need to add the Split artifact to your project, create a Split client through your favorite injection framework, and then you’re ready to start splitting your code.

Initiating the SDK

Split's Java SDK can be added as a library using your favorite package manager, such as Maven or Gradle.

Here’s an example of adding the Split artifact to a project using Maven for dependency management:

          <dependency>
  <groupId>io.split.client</groupId>
  <artifactId>java-client</artifactId>
  <version>2.0.2</version>
</dependency>
        

Once the artifact is in the classpath, it's ready to be imported and ready to be set up.

Instantiating the SDK

Next you’ll need to instantiate the SDK:

          import io.split.client.SplitFactoryBuilder;
import io.split.client.SplitClient;

SplitClientConfig config = SplitClientConfig.builder()
   .ready(10000)
   .build();

SplitFactory splitFactory = SplitFactoryBuilder.build("YOUR_API_KEY", config);
SplitClient sdk = splitFactory.client();

        

And that’s it.

Splitting your code.

With the SDK instantiated, it’s now time to start splitting your code base. Find a feature you’d like to split, and wrap it in the split feature flag like so:

          String treatment = sdk.getTreatment("CUSTOMER_ID","SPLIT_NAME");

if (treatment.equals("on")) {
    // insert code here to show on treatment
} else if (treatment.equals("off")) {
    // insert code here to show off treatment
} else {
    // insert your control treatment code here
}
        

The Split Java SDK integrates seamlessly into your code; no other changes or dependencies are needed to get Split up and running.

To continue diving into Split, sign up for a free account today, or dig into our Java SDK documentation.

Related Resources