Announcement Announcement Module
Collapse
No announcement yet.
Manually configure the JSON serialization Mapper for a REST service Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Manually configure the JSON serialization Mapper for a REST service

    Hi,

    We have a web service delivering JSON and want to include now a library which depends on fasterXml's Jackson. But we want to use codehouse's Jackson as we did before as there is a difference how the JodaTime objects are serialized and we know that the clients are using an older spring version with the same Jackson.

    How to I tell spring, in our context xml file, to use the codehouse ObjectMapper for Json Serialization?

    Thanks and Regards
    Paul.

  • #2
    I managed it with this configuration (in the correct context file...):

    <bean id="jacksonObjectMapper" class="org.codehaus.jackson.map.ObjectMapper" />
    <mvc:annotation-driven>
    <mvc:message-converters register-defaults="true">
    <bean id="jacksonMessageConverter"
    class="org.springframework.http.converter.json.Map pingJacksonHttpMessageConverter">
    <property name="objectMapper" ref="jacksonObjectMapper" />
    </bean>
    </mvc:message-converters>
    </mvc:annotation-driven>

    Comment

    Working...
    X