Permalink
Browse files

Support HttpMessageConverter refs in mvc namespace

Issue: SPR-9469
  • Loading branch information...
1 parent 62f2858 commit ecce7520fb2cb56494d78dcc6adadb446d51ace7 @rstoyanchev rstoyanchev committed Nov 14, 2012
@@ -397,10 +397,9 @@ private RuntimeBeanReference getAsyncExecutor(Element element, Object source, Pa
ManagedList<? super Object> messageConverters = new ManagedList<Object>();
if (convertersElement != null) {
messageConverters.setSource(source);
- for (Element converter : DomUtils.getChildElementsByTagName(convertersElement, "bean")) {
- BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter);
- beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef);
- messageConverters.add(beanDef);
+ for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, new String[] { "bean", "ref" })) {
+ Object object = parserContext.getDelegate().parsePropertySubElement(beanElement, null);
+ messageConverters.add(object);
}
}
@@ -33,13 +33,22 @@
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="beans:bean" minOccurs="1" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation><![CDATA[
- The HttpMessageConverter bean definition.
- ]]></xsd:documentation>
- </xsd:annotation>
- </xsd:element>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element ref="beans:bean">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+ An HttpMessageConverter bean definition.
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element ref="beans:ref">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+ A reference to an HttpMessageConverter bean.
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:choice>
</xsd:sequence>
<xsd:attribute name="register-defaults" type="xsd:boolean" default="true">
<xsd:annotation>
@@ -2,14 +2,17 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+ http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<mvc:annotation-driven>
<mvc:message-converters register-defaults="false">
- <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
- <bean class="org.springframework.http.converter.ResourceHttpMessageConverter"/>
+ <ref bean="stringConverter" />
+ <ref bean="resourceConverter" />
</mvc:message-converters>
</mvc:annotation-driven>
+ <bean id="stringConverter" class="org.springframework.http.converter.StringHttpMessageConverter"/>
+ <bean id="resourceConverter" class="org.springframework.http.converter.ResourceHttpMessageConverter"/>
+
</beans>

0 comments on commit ecce752

Please sign in to comment.