Skip to content

Commit a3c47ec

Browse files
author
mokhan
committed
@GetMapping and @PostMapping instead of @RequestMappings change
1 parent 553c26c commit a3c47ec

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎spring-rest/src/main/java/com/baeldung/web/log/controller/TaxiFareController.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import org.slf4j.LoggerFactory;
77
import org.springframework.beans.factory.annotation.Autowired;
88
import org.springframework.stereotype.Controller;
9+
import org.springframework.web.bind.annotation.GetMapping;
10+
import org.springframework.web.bind.annotation.PostMapping;
911
import org.springframework.web.bind.annotation.RequestBody;
10-
import org.springframework.web.bind.annotation.RequestMapping;
11-
import org.springframework.web.bind.annotation.RequestMethod;
1212
import org.springframework.web.bind.annotation.ResponseBody;
1313

1414
import com.baeldung.web.log.data.RateCard;
@@ -23,14 +23,14 @@ public class TaxiFareController {
2323

2424
private static final Logger LOGGER = LoggerFactory.getLogger(TaxiFareController.class);
2525

26-
@RequestMapping(method = RequestMethod.GET, value = "/taxifare/get/")
26+
@GetMapping(value = "/taxifare/get/")
2727
@ResponseBody
2828
public RateCard getTaxiFare() {
2929
LOGGER.debug("getTaxiFare() - START");
3030
return new RateCard();
3131
}
3232

33-
@RequestMapping(method = RequestMethod.POST, value = "/taxifare/calculate/")
33+
@PostMapping(value = "/taxifare/calculate/")
3434
@ResponseBody
3535
public String calculateTaxiFare(@RequestBody @Valid TaxiRide taxiRide) {
3636
LOGGER.debug("calculateTaxiFare() - START");

0 commit comments

Comments
 (0)