Spring unable to map single value from POST


I am currently using Vue and Spring Boot. Between these two, the communication is done using axios. However, when I try to pass a single value over to Spring Boot from Vue, my Spring keep prompting “Required request parameter “testparam”… is not present”

Here is how I am sending from Vue to Spring:

    .post("url/test", {
        testparam: 1,
        .then((response) > {
        .catch((error) > {

And here is how I am receiving it from Spring:

@PostMapping(path  "/test")
public Integer test1(@RequestParam(name  "testparam") Integer testparam) {
    return testparam;


You’re expecting a query param, and in your Axios call, you’re sending param in a request body. To fix it, simply send it like this:

axios.post("url/test", {}, { params: { testparam: 1 } })

Answered By – Branislav Lazic

Leave a Comment