Answer the question
In order to leave comments, you need to log in
How to make automatic mapping of one value to a list in RestController Spring parameters?
How to make callMethod work when passing in POST parameters both array "[1,2,3]" and single value "1"?
@RequestMapping("/api/")
@RestController
public class MyController {
@PostMapping("/callMethod")
public void callMethod(@RequestBody List<Long> ids) {
Answer the question
In order to leave comments, you need to log in
Maybe you made the request incorrectly? Works for me with the latest Spring Boot:
@RestController
@RequestMapping("")
public class IndexController {
@PostMapping("")
public void index(@RequestParam List<Long> ids){
System.out.println(ids);
}
}
curl --request POST --url 'http://localhost:8080/?ids=11'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question