Created
March 23, 2013 20:21
-
-
Save iamakimmer/5229207 to your computer and use it in GitHub Desktop.
how to set up your spring config to respond to json/xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Enable annotation scanning. --> | |
<context:component-scan base-package="com.matthewjkim.controllers" /> | |
<!-- Map objects to XML. --> | |
<bean id="xstreamMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller" /> | |
<bean id="xmlMessageConverter" class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter"> | |
<constructor-arg ref="xstreamMarshaller" /> | |
</bean> | |
<bean id="jsonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /> | |
<!-- Bind the return value of the Rest service to the ResponseBody. --> | |
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> | |
<property name="messageConverters"> | |
<util:list id="beanList"> | |
<ref bean="xmlMessageConverter" /> | |
<ref bean="jsonHttpMessageConverter" /> | |
</util:list> | |
</property> | |
</bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment