We've built a simple console application that demonstrates how to use LaunchDarkly's Java SDK in a Scala application. There isn't a separate Scala SDK. Below, you'll find the basic build procedure, but for more comprehensive instructions, you can visit your Quickstart page or the Java SDK reference guide.
Note that this sample application does not use any functional programming frameworks such as Scalaz or Cats. Rather, the application exhibits how to use the LaunchDarkly Server-Side SDK for Java in a vanilla Scala application.
This project uses SBT. It requires that Java is already installed on your system (version 8 or higher). It will automatically use the latest release of the LaunchDarkly SDK with major version 5.
- Edit
src/main/scala/Hello.scala
and set the value ofsdkKey
to your LaunchDarkly SDK key. If there is an existing boolean feature flag in your LaunchDarkly project that you want to evaluate, setfeatureFlagKey
to the flag key.
val sdkKey = "1234567890abcdef"
val featureFlagKey = "my-flag"
-
To install the SDK and build the demo:
sbt compile
-
To run the demo:
sbt run
You should see the message "Feature flag '<flag key>' is <true/false> for this user"
.