Monday, February 14, 2011

HttpMediaTypeNotAcceptableException

Using spring mvc and the @ResponseBody annotation might give you the HttpMediaTypeNotAcceptableException if you set the "Accept" header to "application/json". To solve this, add jackson-jaxrs to your classpath.  Nothing else needs to be done, spring does it's magic.

In your test , slap on a @Autowired on your AnnotationMethodHandlerAdapter.

No comments:

Post a Comment