In Spring REST, is the request object instantiated on each request?

Viewed 1133

I am having trouble finding a solid answer to this. I know that the controller is scoped singleton and instantiated once, same would be for any member variables in the controller class.

My question: is the incoming request object a new instance on each request? Assuming Jackson is mapping a JSON request body to the request object.

For example:

@RequestMapping(path = "/dosomething", method = POST)
@ResponseBody
public SomeObject doSomething(@RequestBody SomeObject someObject) {
    // code here
    return someObject;
}

I would like to process/store or otherwise change the state of someObject, but am not sure how safe that is when handling many requests, or if I need to explicitly instantiate a new SomeObject deep copied from the inbound request object.

Thanks for any help!

1 Answers
Related