With Spring 4, if your Controller is annotated with @RestController
instead of @Controller
, you don't need the @ResponseBody
annotation.
The code would be
@RestController
public class FooController {
@RequestMapping(value="/controller", method=GET)
public String foo() {
return "Response!";
}
}
You can find the Javadoc for @RestController
here