and instead of change
@@ -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");
