Spring version 4.2.0, Hibernate 4.1.4
Here is my Controller
function:
@RequestMapping(value = \"/mobile/getcomp\", method = Req
You also need to be sure that returned bean is not empty (and can be serialized by Jackson). In my particular case I tried to return an instance of an object without getters and setters and without any jackson annotation and with fields equals to null. I got following message:
com.fasterxml.jackson.databind.JsonMappingException:
No serializer found for class com.foo.bar.Baz and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
Considering @Arpit answer, for me it worked only when I add two jackson dependencies:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.3</version>
</dependency>
and configured, of cause, web.xml <mvc:annotation-driven/>
.
Original answer that helped me is here: https://stackoverflow.com/a/33896080/3014866