Add Spring boot with Rest controller
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
package org.example
|
||||
|
||||
fun main() {
|
||||
println("Hello World!")
|
||||
}
|
||||
11
src/main/kotlin/org/example/Application.kt
Normal file
11
src/main/kotlin/org/example/Application.kt
Normal file
@@ -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<String>) {
|
||||
runApplication<Application>(*args)
|
||||
}
|
||||
13
src/main/kotlin/org/example/HelloController.kt
Normal file
13
src/main/kotlin/org/example/HelloController.kt
Normal file
@@ -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!"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user