在开发过程中,我们需要统一返回前端json格式的数据,但有些接口的返回值存在 null或者""这种没有意义的字段.以上不仅影响理解,还浪费带宽,这时我们可以统一做一下处理:不返回空字段,或者把NULL转成“”. 要做要以上,经过网上寻找资料,发现很多文章都是相互拷贝,于是从网上自己寻找资料,对他们进行整理,记录,同时可以对返回的null字段进行灵活配置. spring 内置的json处理框架是Jackson.我们可以对它配置一下达到目的,具体代码如下. @Configuration p
1.当上传时未配置上传内容大小,会报错[org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException]. 此时,可以在启动类中配置以下代码. @Bean public MultipartConfigElement multipartConfigElement() { MultipartConfigFactory factory = new MultipartConfigFactory(); fac