Java annotations in odd places

annotations, java, spring

Solution

The `@ResponseBody` is actually just a Plain-Jane Method annotation. You're allowed to put them after the scope keyword.

The `@RequestParam` annotation isn't part of the method signature. It's a Parameter Annotation.

Problem

Browsing through the source of a spring framework project i came across a method that looked like this: ``` @RequestMapping("primitive") public @ResponseBody String primitive(@RequestParam Integer value) { return "Converted primitive " + value; } ``` Being only a casual java user, ive not come across this before. As far as i was aware, the @ symbol preceded java annotations, yet there appear to be annotations in the method signature itself. What are the `@ResponseBody` and `@RequestParam` sections doing?

Original source