title: ContentNegotiatingViewResolver MediaTypes Error after Upgrading to Spring 4.2
body: <p>I have a dispatcher-servlet.xml file that has a <code>Bean</code> like this:</p>
  
  <pre><code>&lt;bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver" p:defaultContentType="text/html"&gt;
      &lt;property name="mediaTypes"&gt;
          &lt;map&gt;
              &lt;entry key="html" value="text/html"/&gt;
              &lt;entry key="json" value="application/json"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
      &lt;property name="viewResolvers"&gt;
          &lt;list&gt;
              &lt;bean id="localBasedViewResolver" class="com.company.web.i18n.LocaleBasedViewResolver"
                    p:viewClass="org.springframework.web.servlet.view.JstlView"
                    p:prefix="${views.prefix}"
                    p:suffix="${views.suffix}"
                    p:cacheUnresolved="false"
                    p:exposedContextBeanNames="webProperties"
                    p:order="1"
                    /&gt;
              &lt;bean id="viewResolver"
                    class="org.springframework.web.servlet.view.InternalResourceViewResolver"
                    p:viewClass="org.springframework.web.servlet.view.JstlView"
                    p:prefix="${views.prefix}"
                    p:suffix="${views.suffix}"
                    p:cacheUnresolved="false"
                    p:exposedContextBeanNames="webProperties"
                    p:order="2"
                    /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="defaultViews"&gt;
          &lt;list&gt;
              &lt;bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>After upgrading to Spring 4.2 I get the following error:</p>
  
  <pre><code>Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'mediaTypes' of bean class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver]: Bean property 'mediaTypes' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
      at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:230) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:423) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:280) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
  </code></pre>
  
  <p>This worked before the upgrade, so any help on how to fix would be greatly appreciated!</p>