Results 1 to 2 of 2

Thread: Manually configure the JSON serialization Mapper for a REST service

  1. #1
    Join Date
    Feb 2013
    Posts
    2

    Default 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. #2
    Join Date
    Feb 2013
    Posts
    2

    Default

    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>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •