MappingJacksonHttpMessageConverter not found with Spring4

I migrated my Spring framework from 3.x to 4.2.RELEASE, but when I run jUnit I get this error:

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:src/test/resources/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/http/converter/json/MappingJacksonHttpMessageConverter  

I have been reading online since version 4.1. it is no longer supported; I checked and the new version is available along the application class path (I imported the spring -web dependency). ( Spring 4 and Rest WS integration )

It seems that Spring is still looking for an old version of the converter. It probably depends on what I have in the context of my application, but the question is, how can I "tell Spring" to use the new version?

- UPDATE
I commented

<mvc:annotation-driven />

and it seems to work just fine, but ... why?

+4
1

Spring 4: org.springframework.http.converter.json.MappingJackson2HttpMessageConverter ( "2" ).

REST Spring ( objectMapper, ):

<mvc:annotation-driven>
    <mvc:message-converters>

        <bean 
            class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
            <property name="objectMapper">
                <bean class="s3.util.json.CustomJsonMapper" />
            </property>
        </bean>

    </mvc:message-converters>
</mvc:annotation-driven>
+7

All Articles