Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
8bb5bf99
Commit
8bb5bf99
authored
Jun 26, 2019
by
qiuweili123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add advice null
parent
301a2ebd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
1 deletions
+3
-1
README.md
README.md
+1
-0
ControllerResponseAdvice.java
web-starter/src/main/java/com/secoo/mall/web/advice/ControllerResponseAdvice.java
+2
-1
No files found.
README.md
View file @
8bb5bf99
...
...
@@ -32,6 +32,7 @@
1、增加monitor traceId监控模块
2、增加防灾冗余
3、优化文件结构
4、增加对controller返回null响应增强
1.
0.2.RELEASE
...
...
web-starter/src/main/java/com/secoo/mall/web/advice/ControllerResponseAdvice.java
View file @
8bb5bf99
...
...
@@ -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.ApiIgnoreJson
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.i18n.LocaleContext
;
import
org.springframework.context.i18n.LocaleContextHolder
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.annotation.AnnotationUtils
;
...
...
@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
;
import
javax.annotation.Resource
;
import
java.util.Locale
;
@RestControllerAdvice
(
annotations
=
ApiController
.
class
)
public
class
ControllerResponseAdvice
implements
ResponseBodyAdvice
<
Object
>
{
...
...
@@ -56,7 +58,6 @@ public class ControllerResponseAdvice implements ResponseBodyAdvice<Object> {
}
private
String
getMsg
(
BusinessException
e
)
{
LoggerUtil
.
info
(
"local:{}"
,
LocaleContextHolder
.
getLocale
());
return
messageSource
.
getMessage
(
e
.
getMsg
(),
e
.
getArgs
(),
LocaleContextHolder
.
getLocale
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment