Fetched the one and only view-resolver the application context. - turns out to be a ViewResolverComposite.
Iterates over its view-resolvers to find the CNVR
Found the one and only ContentNegotiationManager in the application context.
Used reflection to access the contentNegotiationManager inside the CNVR
Checked to see if the two ContentNegotiationManagers were the same instance - they weren't
Used cnvr.setContentNegotiationManager(contentNegotiationManager) to set the ContentNegotiationManager in the CNVR instance to eb the one in the application context.
After that, when I ran my MockMvc test to fetch JSON, I did get JSON returned. Before it was returning HTML and my test failed - I think because the original ContentNegotiationManager in the CNVR instance was not the one I had configured to look for .json on the end of the URL.
It appears this is sensitive to where the "mvcContentNegotiationManager" bean appears. It works if it is before <mvc:view-resolvers>.
On the implementation side, ViewResolversBeanDefinitionParser is checking if context.getRegistry().containsBeanDefinition(beanName) where beanName is "mvcContentNegotiationManager". Two issues here, one it shouldn't be sensitive to the order of declaration and two it should work in cases where a ContentNegotiationManager is configured with a bean reference, i.e.: