DataJPA/src/main/kotlin/com/chantha/jdbc/controller/CustomerController.kt
2020-05-15 17:20:27 +07:00

18 lines
618 B
Kotlin

package com.chantha.jdbc.controller
import com.chantha.jdbc.jpa.model.Customer
import com.chantha.jdbc.jpa.service.customer.CustomerService
import org.apache.catalina.User
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
@Suppress("UNCHECKED_CAST")
@RestController
class CustomerController @Autowired constructor(private val customerService: CustomerService) {
@GetMapping("/customer")
fun customer():List<Customer>{
return customerService.findAll().toList()
}
}