Suppose I have the following code snippet:
@RequestMapping(method = RequestMethod.GET)
public List<Article> getArticles(@RequestParam int offset,
@RequestParam int limit) {
...
}
How can Spring match the HTTP query parameters to the right formal parameters, when the parameter name is not explicitly stated as an annotation parameter?
Does it suppose the formal parameter names are always present in bytecode?
As I understand, it does not always have to be so. The formal parameter names can be retrieved from bytecode only when:
a) the class file has been compiled with -parameters javac option
b) the class file has been compiled with -g (or -g:vars) javac option, which adds debug information including the true variable names (since the formal parameters are stored as the first local variables of method)