I have a simple @Controller
within a spring-mvc
environment. This is the Controller:
@Controll
I guess it's related to default view name resolution.
If you want a value returned by your handler method to be encoded as response body (in JSON, XML, etc), you need to annoate the method with @ResponseBody
, or annotate the whole controller with @RestController
(in Spring 4.x).
Otherwise, Spring tries to render a view with your return as model attribute. And since you didn't provide a name of a view to render, Spring tries to deduce it from request URL.