Newer
Older
sample-kotlin-spring+mybatis / src / main / kotlin / com / example / sample / controller / Hello.kt
package com.example.sample.controller

import com.example.sample.entity.BookDto
import com.example.sample.service.SampleService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.ResponseBody
import org.springframework.web.bind.annotation.RestController

@RestController
class Hello (private val sampleService: SampleService){
    @GetMapping("/hello")
    fun sample(): String = "Hello"

    @GetMapping("/test")
    @ResponseBody
    fun hoge() : BookDto =
        sampleService.execute()
}