January 2018
Intermediate to advanced
414 pages
10h 29m
English
Now, we can modify the controller itself to use the new service:
package com.microservices.chapter3import org.springframework.beans.factory.annotation.Autowiredimport org.springframework.web.bind.annotation.*@RestControllerclass CustomerController { @Autowired private lateinit var customerService: CustomerService @GetMapping(value = "/customer/{id}") fun getCustomer(@PathVariable id: Int) = customerService.getCustomer(id) @PostMapping(value = "/customer/") fun createCustomer(@RequestBody customer: Customer) { customerService.createCustomer(customer) } @DeleteMapping(value = "/customer/{id}") fun deleteCustomer(@PathVariable id: Int) { customerService.deleteCustomer(id) } @PutMapping(value = "/customer/{id}") fun updateCustomer(@PathVariable ...Read now
Unlock full access