Further improve detecttion of custom CNVR

Refine the approach of having <mvc:view-resolvers> detect and use the
ContentNegotiationManager instance registered with
<mvc:annotation-driven> introduced in the last commit.

Issue: SPR-13559
This commit is contained in:
Rossen Stoyanchev
2015-10-29 20:53:36 -04:00
parent f84a0c914a
commit c5995149b3
4 changed files with 44 additions and 26 deletions

View File

@@ -691,7 +691,7 @@ public class MvcNamespaceTests {
@Test
public void testContentNegotiationManager() throws Exception {
loadBeanDefinitions("mvc-config-content-negotiation-manager.xml", 15);
loadBeanDefinitions("mvc-config-content-negotiation-manager.xml", 14);
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
ContentNegotiationManager manager = mapping.getContentNegotiationManager();

View File

@@ -7,13 +7,13 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" />
<mvc:annotation-driven content-negotiation-manager="mvcContentNegotiationManager" />
<mvc:view-resolvers>
<mvc:content-negotiation/>
</mvc:view-resolvers>
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<bean id="mvcContentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="mediaTypes">
<value>
xml=application/rss+xml