全局响应结果媒体类型替换
作者:
盗生一 | 来源:发表于
2020-12-11 19:58 被阅读0次package com.gxhj.safecommunity.configuration.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 设置默认返回结构
*/
@Configuration
@EnableWebMvc
public class WebConfiguration implements WebMvcConfigurer {
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.APPLICATION_XML);
}
}
本文标题:全局响应结果媒体类型替换
本文链接:https://www.haomeiwen.com/subject/bllsgktx.html
网友评论