Skip to content

Instantly share code, notes, and snippets.

@qsLI
Created November 15, 2016 16:04
Show Gist options
  • Save qsLI/c7149e56101e45f1df51eafe111c58b5 to your computer and use it in GitHub Desktop.
Save qsLI/c7149e56101e45f1df51eafe111c58b5 to your computer and use it in GitHub Desktop.
<!-- JSON parser configuration-->
<bean id="guavaObjectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject"><ref local="guavaObjectMapper" /></property>
<property name="targetMethod"><value>registerModule</value></property>
<property name="arguments">
<list>
<bean id="guavaModule" class="com.fasterxml.jackson.datatype.guava.GuavaModule"/>
</list>
</property>
</bean>
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper">
<ref local="guavaObjectMapper"/>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment