@GetMapping("/example")
public ResponseEntity<List<Sample>> requestParam(
@RequestParam(value="example1", required=false) final String example1,
@RequestParam(value="example2", defaultValue="2") final String example2) {
final List<Sample> sampleList = example1 != null
? sampleService.getSampleList(example1)
: sampleService.g etSampleList();
return ResponseEntity.ok(sampleList);
}
@PostMapping("/example")
public ResponseEntity<Sample> modelAttribute(@ModelAttribute final Sample sample) {
return ResponseEntity.ok(sampleService.add(sample));
}
@PostMapping("/example")
public ResponseEntity<Sample> requestBody(@RequestBody final Sample sample) {
return ResponseEntity.ok(sampleService.add(sample));
}
@RequestBody, @ModelAttribute, @RequestParam