@GetMapping and @PostMapping instead of @RequestMappings change

This commit is contained in:
mokhan 2017-07-26 21:01:36 +05:30
parent 553c26c1a2
commit a3c47eca35
1 changed files with 4 additions and 4 deletions

View File

@ -6,9 +6,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.baeldung.web.log.data.RateCard;
@ -23,14 +23,14 @@ public class TaxiFareController {
private static final Logger LOGGER = LoggerFactory.getLogger(TaxiFareController.class);
@RequestMapping(method = RequestMethod.GET, value = "/taxifare/get/")
@GetMapping(value = "/taxifare/get/")
@ResponseBody
public RateCard getTaxiFare() {
LOGGER.debug("getTaxiFare() - START");
return new RateCard();
}
@RequestMapping(method = RequestMethod.POST, value = "/taxifare/calculate/")
@PostMapping(value = "/taxifare/calculate/")
@ResponseBody
public String calculateTaxiFare(@RequestBody @Valid TaxiRide taxiRide) {
LOGGER.debug("calculateTaxiFare() - START");