I've a webservice similar to the following:
@RequestMapping(value = "/getMovies", method = RequestMethod.POST, produces = "application/json")
public @ResponseBody ResponseVO getMoviesList(@RequestBody RequestVO vo) { .... }
The RequestVO
class is :
public class RequestVO {
private String[] genreList;
public void updateRequest() {
if (genreList != null) {
// remove the duplicates from the list
// or something else
}
}
public String[] getGenreList() {
return genreList;
}
public void setGenreList(String[] genreList) {
this.genreList = genreList;
}
}
Now I want the method updateRequest
to be called automatically after the request json is processed as RequestVO
. One thing I currently think of is @PostConstruct
, but seems to be of no use in this case.
My question is does Spring
provide any such annotation or mechanism ? Or @PostConstruct
will do the trick ?
NB : I don't need workarounds as I've plenty of them. So please refrain yourself from posting them. Again above codes are mere samples (please ignore minor mistakes).