Commit 8bb5bf99 by qiuweili123

add advice null

parent 301a2ebd
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
1、增加monitor traceId监控模块 1、增加monitor traceId监控模块
2、增加防灾冗余 2、增加防灾冗余
3、优化文件结构 3、优化文件结构
4、增加对controller返回null响应增强
1.0.2.RELEASE 1.0.2.RELEASE
......
...@@ -8,6 +8,7 @@ import com.secoo.mall.common.util.response.ResponseUtil; ...@@ -8,6 +8,7 @@ import com.secoo.mall.common.util.response.ResponseUtil;
import com.secoo.mall.web.annotation.ApiController; import com.secoo.mall.web.annotation.ApiController;
import com.secoo.mall.web.annotation.ApiIgnoreJson; import com.secoo.mall.web.annotation.ApiIgnoreJson;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContext;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.MethodParameter; import org.springframework.core.MethodParameter;
import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.AnnotationUtils;
...@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; ...@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Locale;
@RestControllerAdvice(annotations = ApiController.class) @RestControllerAdvice(annotations = ApiController.class)
public class ControllerResponseAdvice implements ResponseBodyAdvice<Object> { public class ControllerResponseAdvice implements ResponseBodyAdvice<Object> {
...@@ -56,7 +58,6 @@ public class ControllerResponseAdvice implements ResponseBodyAdvice<Object> { ...@@ -56,7 +58,6 @@ public class ControllerResponseAdvice implements ResponseBodyAdvice<Object> {
} }
private String getMsg(BusinessException e) { private String getMsg(BusinessException e) {
LoggerUtil.info("local:{}", LocaleContextHolder.getLocale());
return messageSource.getMessage(e.getMsg(), e.getArgs(), LocaleContextHolder.getLocale()); return messageSource.getMessage(e.getMsg(), e.getArgs(), LocaleContextHolder.getLocale());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment