Skip to content

Commit 7ae4e6f

Browse files
author
Laura
authored
Initial setup of java example app (#1)
1 parent f152a3e commit 7ae4e6f

File tree

16 files changed

+720
-21
lines changed

16 files changed

+720
-21
lines changed

.env.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## DevCycle SDK Key ##
2+
# This can be found in the DevCycle dashboard Settings under "Environments & Keys"
3+
DEVCYCLE_SERVER_SDK_KEY="<YOUR_SDK_KEY>"

.gitignore

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,39 @@
1-
# Compiled class file
2-
*.class
1+
HELP.md
2+
.gradle
3+
build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
!**/src/main/**/build/
6+
!**/src/test/**/build/
37

4-
# Log file
5-
*.log
8+
### STS ###
9+
.apt_generated
10+
.classpath
11+
.factorypath
12+
.project
13+
.settings
14+
.springBeans
15+
.sts4-cache
16+
bin/
17+
!**/src/main/**/bin/
18+
!**/src/test/**/bin/
619

7-
# BlueJ files
8-
*.ctxt
20+
### IntelliJ IDEA ###
21+
.idea
22+
*.iws
23+
*.iml
24+
*.ipr
25+
out/
26+
!**/src/main/**/out/
27+
!**/src/test/**/out/
928

10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
29+
### NetBeans ###
30+
/nbproject/private/
31+
/nbbuild/
32+
/dist/
33+
/nbdist/
34+
/.nb-gradle/
1235

13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
36+
### VS Code ###
37+
.vscode/
2138

22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
24-
replay_pid*
39+
.env

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
1-
# example-java
2-
An example app built using the DevCycle Java SDK
1+
# DevCycle Java Server SDK Example App
2+
3+
An example app built using the [DevCycle Java Server SDK](https://docs.devcycle.com/sdk/server-side-sdks/java/) with local bucketing
4+
5+
## Requirements
6+
7+
Java 17+
8+
9+
## Creating a Demo Feature
10+
This example app requires that your project has a feature with the expected variables, as well as some simple targeting rules.
11+
12+
#### [Click here](https://app.devcycle.com/r/create?resource=feature&key=hello-togglebot) to automatically create the feature in your project ⇦
13+
14+
When you run the example app and switch your identity between users, you'll be able to see the feature's different variations.
15+
16+
## Running the Example
17+
### Setup
18+
19+
* Create a `.env` file and set `DEVCYCLE_SERVER_SDK_KEY` to your Environment's SDK Key.\
20+
You can find this under [Settings > Environments](https://app.devcycle.com/r/environments) on the DevCycle dashboard.
21+
[Learn more about environments](https://docs.devcycle.com/essentials/environments).
22+
23+
### Development
24+
25+
`./gradlew bootRun`
26+
27+
Runs the app in the development mode.\
28+
Requests may be sent to [http://localhost:8080](http://localhost:8080).
29+
30+
## Documentation
31+
For more information about using the DevCycle Java Server SDK, see [the documentation](https://docs.devcycle.com/sdk/server-side-sdks/java/)
32+
33+
### Additional Links
34+
These additional references should also help you:
35+
36+
* [Official Gradle documentation](https://docs.gradle.org)
37+
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.2/gradle-plugin/reference/html/)
38+
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.2/gradle-plugin/reference/html/#build-image)
39+
* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle)

build.gradle

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '3.2.2'
4+
id 'io.spring.dependency-management' version '1.1.4'
5+
}
6+
7+
group = 'com.hello_togglebot'
8+
version = '0.0.1-SNAPSHOT'
9+
10+
java {
11+
sourceCompatibility = '17'
12+
}
13+
14+
repositories {
15+
mavenCentral()
16+
}
17+
18+
dependencies {
19+
implementation 'com.devcycle:java-server-sdk:+'
20+
implementation 'org.springframework.boot:spring-boot-starter-web'
21+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
22+
implementation 'io.github.cdimascio:dotenv-java:3.0.0'
23+
}
24+
25+
tasks.named('test') {
26+
useJUnitPlatform()
27+
}
28+
29+
apply plugin: 'application'
30+
31+
mainClassName = 'com.hello_togglebot.HelloApplication'
32+

gradle/wrapper/gradle-wrapper.jar

42.4 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

gradlew

Lines changed: 249 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)