ExampleController.kt 569 B

123456789101112131415161718192021222324
  1. package com.gxzc.zen
  2. import org.springframework.boot.autoconfigure.EnableAutoConfiguration
  3. import org.springframework.web.bind.annotation.RestController
  4. import org.springframework.web.bind.annotation.PathVariable
  5. import org.springframework.web.bind.annotation.RequestMapping
  6. @RestController
  7. @EnableAutoConfiguration
  8. class ExampleController {
  9. @RequestMapping("/")
  10. fun home(): String {
  11. return "Hello World!"
  12. }
  13. @RequestMapping("/hello/{myName}")
  14. fun index(@PathVariable myName: String): String {
  15. return "Hello $myName!!!"
  16. }
  17. }