diff --git a/build.gradle.kts b/build.gradle.kts index c77ecf8..947bfd7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,8 @@ plugins { kotlin("jvm") version "2.0.0" + kotlin("plugin.spring") version "1.9.22" + id("org.springframework.boot") version "3.1.0" + id("io.spring.dependency-management") version "1.1.0" } group = "org.example" @@ -10,6 +13,8 @@ repositories { } dependencies { + implementation("org.springframework.boot:spring-boot-starter-web") + testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation(kotlin("test")) } diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt deleted file mode 100644 index 732adf1..0000000 --- a/src/main/kotlin/Main.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.example - -fun main() { - println("Hello World!") -} \ No newline at end of file diff --git a/src/main/kotlin/org/example/Application.kt b/src/main/kotlin/org/example/Application.kt new file mode 100644 index 0000000..8051ff6 --- /dev/null +++ b/src/main/kotlin/org/example/Application.kt @@ -0,0 +1,11 @@ +package org.example + +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/src/main/kotlin/org/example/HelloController.kt b/src/main/kotlin/org/example/HelloController.kt new file mode 100644 index 0000000..6150380 --- /dev/null +++ b/src/main/kotlin/org/example/HelloController.kt @@ -0,0 +1,13 @@ +package org.example + +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RestController + +@RestController +class HelloController { + + @GetMapping("/hello") + fun sayHello(): String { + return "Hello, World!" + } +} \ No newline at end of file