Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot Kotlin example #223

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
java-hello-world-maven-quarkus.zip
java-hello-world-maven-spring-boot.zip
kotlin-hello-world-gradle.zip
kotlin-hello-world-gradle-spring-boot.zip
typescript-hello-world.zip
typescript-hello-world-lambda-cdk.zip
typescript-bun-hello-world.zip
Expand Down
1 change: 1 addition & 0 deletions .tools/prepare_release_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create_release_zip templates/java-maven java-hello-world-maven
create_release_zip templates/java-maven-spring-boot java-hello-world-maven-spring-boot
create_release_zip templates/java-maven-quarkus java-hello-world-maven-quarkus
create_release_zip templates/kotlin-gradle kotlin-hello-world-gradle
create_release_zip templates/kotlin-gradle-spring-boot kotlin-hello-world-gradle-spring-boot
create_release_zip templates/typescript typescript-hello-world
create_release_zip templates/bun typescript-bun-hello-world
create_release_zip templates/cloudflare-worker typescript-cloudflare-worker-hello-world
Expand Down
1 change: 1 addition & 0 deletions .tools/run_jvm_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pushd $PROJECT_ROOT/templates/java-maven-quarkus && mvn verify && popd
pushd $PROJECT_ROOT/templates/java-maven-spring-boot && mvn verify && popd
pushd $PROJECT_ROOT/templates/kotlin-gradle && ./gradlew --console=plain check && popd
pushd $PROJECT_ROOT/templates/kotlin-gradle-lambda-cdk/lambda && ./gradlew --console=plain check && popd
pushd $PROJECT_ROOT/templates/kotlin-gradle-spring-boot && ./gradlew --console=plain check && popd

pushd $PROJECT_ROOT/basics/basics-java && ./gradlew --console=plain check && popd
pushd $PROJECT_ROOT/basics/basics-kotlin && ./gradlew --console=plain check && popd
Expand Down
1 change: 1 addition & 0 deletions .tools/update_jvm_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ search_and_replace_version_maven $PROJECT_ROOT/templates/java-maven-quarkus
search_and_replace_version_maven $PROJECT_ROOT/templates/java-maven-spring-boot
search_and_replace_version_gradle $PROJECT_ROOT/templates/kotlin-gradle
search_and_replace_version_gradle $PROJECT_ROOT/templates/kotlin-gradle-lambda-cdk/lambda
search_and_replace_version_gradle $PROJECT_ROOT/templates/kotlin-gradle-spring-boot

search_and_replace_version_gradle $PROJECT_ROOT/basics/basics-java
search_and_replace_version_gradle $PROJECT_ROOT/basics/basics-kotlin
Expand Down
3 changes: 3 additions & 0 deletions templates/kotlin-gradle-spring-boot/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
40 changes: 40 additions & 0 deletions templates/kotlin-gradle-spring-boot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Kotlin ###
.kotlin
13 changes: 13 additions & 0 deletions templates/kotlin-gradle-spring-boot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Hello world - Spring Boot example

Sample project configuration of a Restate service using the Kotlin SDK and Spring Boot.

Have a look at the [Kotlin Quickstart guide](https://docs.restate.dev/get_started/quickstart?sdk=kotlin) for more information on how to use this project.

## Starting the service

To start the service, simply run:

```shell
$ ./gradlew bootRun
```
51 changes: 51 additions & 0 deletions templates/kotlin-gradle-spring-boot/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
plugins {
kotlin("jvm") version "2.0.0"
kotlin("plugin.spring") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("com.google.devtools.ksp") version "2.0.0-1.0.21"

id("org.springframework.boot") version "3.4.0"
id("io.spring.dependency-management") version "1.1.6"
}

group = "com.example"
version = "0.0.1-SNAPSHOT"

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenLocal()
mavenCentral()
}

val restateVersion = "1.3.0-SNAPSHOT"

dependencies {
// Annotation processor
ksp("dev.restate:sdk-api-kotlin-gen:$restateVersion")

implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("dev.restate:sdk-spring-boot-kotlin-starter:$restateVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect")

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("dev.restate:sdk-testing:$restateVersion")
// This is needed for tests using coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

kotlin {
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
}
}

tasks.withType<Test> {
useJUnitPlatform()
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading