Add ContentNegotiationManagerFactoryBean
The new FactoryBean facilitates the creation of a ContentNegotiationManager in XML configuration. Issue: SPR-8420
This commit is contained in:
@@ -452,7 +452,7 @@ public class MvcNamespaceTests {
|
||||
|
||||
@Test
|
||||
public void testCustomContentNegotiationManager() throws Exception {
|
||||
loadBeanDefinitions("mvc-config-content-negotiation-manager.xml", 14);
|
||||
loadBeanDefinitions("mvc-config-content-negotiation-manager.xml", 12);
|
||||
|
||||
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
|
||||
ContentNegotiationManager manager = mapping.getContentNegotiationManager();
|
||||
|
||||
@@ -7,23 +7,12 @@
|
||||
|
||||
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" />
|
||||
|
||||
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManager">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
<ref bean="pathExtensionStrategy" />
|
||||
<ref bean="headerStrategy" />
|
||||
</list>
|
||||
</constructor-arg>
|
||||
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
|
||||
<property name="mediaTypes">
|
||||
<value>
|
||||
xml=application/rss+xml
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="pathExtensionStrategy" class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy">
|
||||
<constructor-arg>
|
||||
<map>
|
||||
<entry key="xml" value="application/rss+xml" />
|
||||
</map>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="headerStrategy" class="org.springframework.web.accept.HeaderContentNegotiationStrategy" />
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user