«Je le poste comme mon propre mémo.
URL:http://localhost:8080/date/2018-02-02/2019-01-01 -Important cousin --No. 1. Correspondre au modèle d'URL (cette fois: 02/02/2018)
@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