Use this example application to integrate with CloudBees Unify and test feature management. After integrating, observe changes in the application UI as you update flag values in CloudBees Unify.
In this example, the Rox SDK is already set up, and feature flags are implemented in the code.
Get started with the Java Spring Boot project
To get started with the springboot-fm-example project, follow these steps:
-
Using Git, clone the springboot-fm-example repository to your local machine:
git clone git@github.com:cloudbees-io/springboot-fm-example.git -
In your IDE, select File and open the cloned repository as a Gradle project. You will revisit this project in your IDE later, to run the application.
-
Locate and copy the SDK key:
-
Navigate to .
-
Select an application.
-
Select
next to the SDK key on the page.If no SDK key is available:
-
Navigate to .
-
Select
in the upper-right corner. -
Follow the installation instructions to complete the installation. The SDK key will appear once an application is linked to an environment.
-
Close the installation instructions, and copy the SDK key.
-
-
-
Reopen the project in your IDE.
-
Add the SDK key to the application:
-
Open the
application.yamlfile:src/main/resources/application.yaml -
Locate the following placeholder in the file, and replace it with your SDK key:
key: "<Your CloudBees SDK key>"
-
-
Save the updated file.
-
Run the application in your IDE. For example:
./gradlew bootRun -
To view the application running, go to http://localhost:8080/api/demo in your web browser.
View the imported flags
Now that your application is running:
-
In CloudBees Unify, select Feature management.
-
Select your example application to display the available flags as shown in the table below.
Table 1. Feature flags in the example application Flag name Flag type Description showMessageBoolean
Turns the message on or off.
messageString
Sets the message text.
fontSizeNumber
Sets the message font size in pixels. The flag value has the following variations:
12,16, or24.fontColorString
Sets the message font color. The flag value has the following variations:
red,green, orblue.If no flags are displayed, verify that the environment-specific SDK key is correctly added to the project file:
src/main/resources/application.yamlSave the file, and restart the application.
Apply changes to flags in the UI
-
Select Feature management.
-
Select the application.
-
Select
next to the flag you want to configure. -
Select Configure.
-
Select the Environment.
-
Update a flag value and save your changes.
-
Set the Configuration status to On.
-
The updated flag value is reflected in the application display shortly.
Use the application with multiple SDK keys
You can run multiple instances of the SDK in a single application, each with its own SDK key and environment. Each instance is fully isolated.
Use multiple SDK instances when you need to:
-
Read or compare feature flags across environments without redeploying
-
Support multi-tenant routing using separate environments
-
Combine server-side and client-side evaluations in one application
To use multiple SDK keys, follow these steps:
-
Retrieve the SDK keys for the environments you want to use.
-
Initialize a separate SDK instance for each SDK key.
-
Decide how your application routes requests to the appropriate instance (for example, by tenant, region, or environment selector).
-
Perform any required registration, fetch, or streaming setup for each instance, as supported by your SDK.
-
Evaluate feature flags using the selected SDK instance. Pass a consistent user or context object to ensure accurate targeting.
-
Tag logs or metrics by SDK instance, and shut down any instances you no longer need.
For more information about using multiple SDK keys, refer to Manage multiple SDK keys in your application.
Documentation reference
For installation details, refer to Install the SDK.