samedi 20 août 2016

How to use @PathVariable to Pojo?

I've created a POJO like this.

public class Param(){
    @NotNull
    private Sring paraA;
    @NotNull
    private Sring paraB;

    //Setter and getter
}

And I want to use JSR303 to check it.

@RequestMapping(value = "/test/{paraA}/{paraB}")
@ResponseBody
public BaseJsonRsp test(@PathVariable  @Valid Param param) {
  //doSomething
}

But this code it doesn't work and I've got following error

HTTP Status 500 - Missing URI template variable 'value' for method parameter of type PatchValue!

Why? How to fix it? Thanks.




Aucun commentaire:

Enregistrer un commentaire