From b2141964b9d52da32fdc66e6f92e0b91e8b91d0a Mon Sep 17 00:00:00 2001 From: Robert Mathew Date: Fri, 28 Jun 2024 19:13:04 +0530 Subject: [PATCH] Added Spring boot with status API --- .fleet/run.json | 24 +++++++++++ .fleet/settings.json | 12 ++++++ build.gradle.kts | 3 ++ gradle/libs.versions.toml | 12 +++--- server/build.gradle.kts | 42 +++++++++++++++++++ .../com/sphereon/oid/fed/Application.kt | 11 +++++ .../src/main/resources/application.properties | 4 ++ settings.gradle.kts | 1 + 8 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 .fleet/run.json create mode 100644 .fleet/settings.json create mode 100644 server/build.gradle.kts create mode 100644 server/src/main/kotlin/com/sphereon/oid/fed/Application.kt create mode 100644 server/src/main/resources/application.properties diff --git a/.fleet/run.json b/.fleet/run.json new file mode 100644 index 00000000..2054655b --- /dev/null +++ b/.fleet/run.json @@ -0,0 +1,24 @@ +{ + "configurations": [ + { + "name": "OpenID-Federation [:server:build]", + "type": "gradle", + "workingDir": "C:\\Users\\Robo\\Sphereon\\OpenID-Federation", + "tasks": [":server:build"], + "args": [""], + "initScripts": { + "flmapper": "ext.mapPath = { path -> null }" + } + }, + { + "name": "OpenID-Federation [build]", + "type": "gradle", + "workingDir": "C:\\Users\\Robo\\Sphereon\\OpenID-Federation", + "tasks": ["build"], + "args": [""], + "initScripts": { + "flmapper": "ext.mapPath = { path -> null }" + } + } + ] +} \ No newline at end of file diff --git a/.fleet/settings.json b/.fleet/settings.json new file mode 100644 index 00000000..9c37f817 --- /dev/null +++ b/.fleet/settings.json @@ -0,0 +1,12 @@ +{ + "plugins": [ + { + "type": "add", + "pluginName": "fleet.spring.boot" + }, + { + "type": "add", + "pluginName": "fleet.mercury" + } + ] +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index ec93b697..239576aa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,4 +7,7 @@ plugins { alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.kotlinJvm) apply false alias(libs.plugins.kotlinMultiplatform) apply false + alias(libs.plugins.springboot) apply false + alias(libs.plugins.springDependencyManagement) apply false + alias(libs.plugins.kotlinPluginSpring) apply false } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4559b0da..3db9123b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,8 +14,8 @@ compose-plugin = "1.6.10" junit = "4.13.2" kotlin = "2.0.0" kotlinxSerializationJson = "1.7.0-RC" -ktor = "2.3.11" -logback = "1.5.6" +springboot = "3.3.1" +spingDependencyManagement = "1.1.5" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } @@ -29,10 +29,6 @@ androidx-material = { group = "com.google.android.material", name = "material", androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" } androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } -logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } -ktor-server-core = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" } -ktor-server-netty = { module = "io.ktor:ktor-server-netty-jvm", version.ref = "ktor" } -ktor-server-tests = { module = "io.ktor:ktor-server-tests-jvm", version.ref = "ktor" } [plugins] androidApplication = { id = "com.android.application", version.ref = "agp" } @@ -40,5 +36,7 @@ androidLibrary = { id = "com.android.library", version.ref = "agp" } jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -ktor = { id = "io.ktor.plugin", version.ref = "ktor" } kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +springboot = { id = "org.springframework.boot", version.ref = "springboot"} +springDependencyManagement = { id = "io.spring.dependency-management", version.ref = "spingDependencyManagement"} +kotlinPluginSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } \ No newline at end of file diff --git a/server/build.gradle.kts b/server/build.gradle.kts new file mode 100644 index 00000000..62c99881 --- /dev/null +++ b/server/build.gradle.kts @@ -0,0 +1,42 @@ +plugins { + alias(libs.plugins.springboot) + alias(libs.plugins.springDependencyManagement) + alias(libs.plugins.kotlinJvm) + alias(libs.plugins.kotlinPluginSpring) + application +} + +group = "com.sphereon.oid.fed" +version = "1.0.0" + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +dependencies { + + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin") + implementation("org.jetbrains.kotlin:kotlin-reflect") + + + testImplementation("org.springframework.boot:spring-boot-starter-test") + testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + + runtimeOnly("org.springframework.boot:spring-boot-devtools") + //testImplementation(libs.kotlin.test.junit) +} + +kotlin { + compilerOptions { + freeCompilerArgs.addAll("-Xjsr305=strict") + } +} + +tasks.withType { + useJUnitPlatform() +} \ No newline at end of file diff --git a/server/src/main/kotlin/com/sphereon/oid/fed/Application.kt b/server/src/main/kotlin/com/sphereon/oid/fed/Application.kt new file mode 100644 index 00000000..2d2fe659 --- /dev/null +++ b/server/src/main/kotlin/com/sphereon/oid/fed/Application.kt @@ -0,0 +1,11 @@ +package com.sphereon.oid.fed + +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.runApplication + +@SpringBootApplication +class Application + +fun main(args: Array) { + runApplication(*args) +} \ No newline at end of file diff --git a/server/src/main/resources/application.properties b/server/src/main/resources/application.properties new file mode 100644 index 00000000..e83bf36f --- /dev/null +++ b/server/src/main/resources/application.properties @@ -0,0 +1,4 @@ +spring.application.name=OpenID Federation + +management.endpoints.web.base-path=/ +management.endpoints.web.path-mapping.health=status diff --git a/settings.gradle.kts b/settings.gradle.kts index fbf00ad3..17c9a425 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -29,3 +29,4 @@ dependencyResolutionManagement { } include(":modules:openid-federation-common") +include(":server")