如何在SpringMVC中将cookie值绑定到pojo字段?

如何在SpringMVC中将cookie值绑定到pojo字段?,spring,spring-mvc,spring-boot,Spring,Spring Mvc,Spring Boot,例如,我想将当前请求中cookie的值绑定到下面的pojo @RequestMapping(path="/", method= GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> handleTheRequest(Foo foo){ return blah; } public class Foo{ private string cookieValue; //Ot

例如,我想将当前请求中cookie的值绑定到下面的pojo

@RequestMapping(path="/", method= GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> handleTheRequest(Foo foo){
    return blah;
}

public class Foo{
    private string cookieValue;
    //Other fun fields

    public void setCookieValue(String value){ 
        this.cookieValue = value;
    }

   public string getCookieValue(){
        return cookieValue;
   }
}
@RequestMapping(path=“/”,method=GET,products=MediaType.APPLICATION\u JSON\u VALUE)
公共响应handleTheRequest(Foo-Foo){
返回废话;
}
公开课Foo{
私有字符串值;
//其他游乐场
public void setCookieValue(字符串值){
this.cookieValue=value;
}
公共字符串getCookieValue(){
返回值;
}
}
你能试试吗

@RequestMapping(path="/", method= GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> handleTheRequest(@RequestBody Foo foo){
    return blah;
}
@RequestMapping(path=“/”,method=GET,products=MediaType.APPLICATION\u JSON\u VALUE)
公共响应handleTheRequest(@RequestBody Foo Foo){
返回废话;
}