――I'm posting it as my own memo.
URL:http://localhost:8080/date/2018-02-02/2019-01-01 --Important cousin --No. 1. Match the URL pattern (this time: 2018-02-02)
@RestController
@RequestMapping(value = "/date/{from}/{to}", method = RequestMethod.GET)
public class CsvController {
@GetMapping
public String get(@DateTimeFormat(pattern = "yyyy-MM-dd") @PathVariable LocalDate from,
@DateTimeFormat(pattern = "yyyy-MM-dd") @PathVariable LocalDate to) {
return "fromDate:" + from.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))
+ "toDate:" + to.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
}
Recommended Posts