springMVC3.2 多视图解析器 java.lang.String cannot be cast to org.springframework.http.MediaType

来源:互联网 发布:淘宝保证金怎么扣 编辑:程序博客网 时间:2024/06/05 23:03
SpringMVC 3.2 org.springframework.web.servlet.view.ContentNegotiatingViewResolver 配置如下mediaType报错<property name="mediaTypes"><map>  <entry key="pdf" value="application/pdf"/>  <entry key="html" value="text/html"/>  <entry key="json" value="application/json"/></map></property>换成
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="contentNegotiationManager"><bean class="org.springframework.web.accept.ContentNegotiationManager"><constructor-arg>    <list>    <!-- These are evaluated in order -->    <!-- Is there a media type based on suffix? --><bean                  class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy"><constructor-arg>    <map><entry key="html" value="text/html" /><entry key="json" value="application/json" /><entry key="pdf" value="application/pdf" /></map></constructor-arg></bean><!-- Else use request header --><bean            class="org.springframework.web.accept.HeaderContentNegotiationStrategy"></bean></list></constructor-arg></bean></property></bean>

阅读全文
0 0
原创粉丝点击