I want implement a web-service which consumes only one named parameter in request-payload. In curl view it should be smth like: curl -X PATCH myurl.net/my_service -d "{mySingleParameter: 49}"
I'm trying to do it with Spring, but I wondered that to map such payload to my method I must to declare a new class. Like:
...
public static class PayloadWithSingleParamMSP{
public Long mySingleParameter;
}
@RequestMapping(value = "my_service", method = RequestMethod.PATCH)
public String myService(@RequestBody PayloadWithSingleParamMSP payload){
Long valueWhichIReallyNeed = payload.mySingleParameter;
//do job
...
}
...
But is there a way to take value which I really need (mySingleParameter) directly?