To return JSON response from @ResponseBody
-annotated method, you need two things:
<mvc:annotation-driven />
(you already have it)- Jackson JSON Mapper in the classpath
You don’t need ContentNegotiatingViewResolver
and headers
in @RequestMapping
.
More Related Contents:
- JQuery, Spring MVC @RequestBody and JSON – making it work together
- How to customise the Jackson JSON mapper implicitly used by Spring Boot?
- Spring configure @ResponseBody JSON format
- How to configure MappingJacksonHttpMessageConverter while using spring annotation-based configuration?
- Http Post request with content type application/x-www-form-urlencoded not working in Spring
- Serializing enums with Jackson
- Jackson 2.0 with Spring 3.1
- Parsing JSON in Spring MVC using Jackson JSON
- How do I obtain the Jackson ObjectMapper in use by Spring 4.1?
- Spring 3.0 making JSON response using jackson message converter
- HTTP Status 406. Spring MVC 4.0, jQuery, JSON
- Why does Jackson 2 not recognize the first capital letter if the leading camel case word is only a single letter long?
- Spring-MVC 406 Not Acceptable instead of JSON Response
- What causes “java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘command’ available as request attribute”?
- Spring Security : Multiple HTTP Config not working
- Redirect to an external URL from controller action in Spring MVC
- Increase HTTP Post maxPostSize in Spring Boot
- Spring MVC type conversion : PropertyEditor or Converter?
- What to return if Spring MVC controller method doesn’t return value?
- Spring Boot JSP 404
- Configure ViewResolver with Spring Boot and annotations gives No mapping found for HTTP request with URI error
- Is it possible to have empty RequestParam values use the defaultValue?
- how to send an array in url request
- How to re-create database before each test in Spring?
- Autowiring fails: Not an managed Type
- Spring Partial Update Object Data Binding
- Accessing Spring beans from a Tiles view (JSP)
- How to import value from properties file and use it in annotation?
- Spring @JsonIgnore not working
- Maven- No plugin found for prefix ‘spring-boot’ in the current project and in the plugin groups