| package com.dy.common.webUtil; | 
|   | 
| import org.springframework.context.annotation.Configuration; | 
| import org.springframework.http.MediaType; | 
| import org.springframework.web.servlet.config.annotation.*; | 
|   | 
| @Configuration | 
| public class ResponseContentTypeConfig implements WebMvcConfigurer { | 
|   | 
|     @Override | 
|     public void configurePathMatch(PathMatchConfigurer pathMatchConfigurer) { | 
|   | 
|     } | 
|   | 
|     /** | 
|      * Springboot请求响应头的Content-TypeContent-Type默认是text/plain, | 
|      * 下面配置请求响应头的Content-TypeContent-Type默认为application/json | 
|      * @param configurer | 
|      */ | 
|     @Override | 
|     public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { | 
|         configurer.defaultContentType(MediaType.APPLICATION_JSON); | 
|     } | 
|   | 
| } |