springboot中统一返回rest数据格式(含400)
(2022-03-23 11:06:09)
标签:
springbootrest400返回格式 |
分类: java |
1. response
import lombok.Data;
@Data
public class Response {
}
2.config
import java.util.HashMap;
import java.util.List;
import com.sunginfo.assets.model.Response;
import
org.springframework.context.annotation.Configuration;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import
org.springframework.http.converter.HttpMessageConverter;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import
org.springframework.http.server.ServerHttpRequest;
import
org.springframework.http.server.ServerHttpResponse;
import
org.springframework.web.bind.annotation.RestControllerAdvice;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
@Configuration
public class GlobalReturnConfig {
前一篇:jpa配置mysql8
后一篇:rest统一返回格式