Newer
Older
sample-kotlin-spring+mybatis / src / main / kotlin / com / example / sample / controller / Hello.kt
yhornisse on 12 Mar 2020 649 bytes Add Sample.
package com.example.sample.controller

import com.example.sample.entity.BookDto
import com.example.sample.service.SampleService
import lombok.RequiredArgsConstructor
import org.springframework.transaction.annotation.Transactional
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()
}