import javax.validation.constraints.Pattern;
public class Data {
Details details ;
}
public class Details {
@Pattern(regexp = "^[//a-zA-Z0-9]+$", message = "yyyyy")
private String Id;
}
In controller layer
@RequestMapping(value = "/xyz", method = RequestMethod.POST)
public Object create(@Valid @RequestBody Data policy, HttpServletRequest request,
HttpServletResponse response){
}
I need the validations that is present in Details class . It is a sub-class of Data. In controller layer, i have given RequestBody Data and @valid annotation is there I am trying from postman , but not able to throw the @Pattern validation.