Maven配置
<!-- 引入jackson,防止ajax调用返回json出现下载文件 --> <!--MappingJacksonHttpMessageConverter <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.13</version> </dependency> --> <!-- 引入jackson,防止ajax调用返回json出现下载文件 --> <!-- MappingJackson2HttpMessageConverter --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.5.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.5.1</version> </dependency> |
Spring-mvc.xml 配置
<!--避免IE执行AJAX时,返回JSON出现下载文件 --> <bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> </list> </property> </bean> |
Spring4.1.1去掉了MappingJacksonHttpMessageConverter
spring-mvc配置将MappingJacksonHttpMessageConverter改成MappingJackson2HttpMessageConverter,
Maven对org.codehaus.jackson的引用,改用 com.fasterxml.jackson.core
时间: 2024-11-06 10:15:39