Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
f038253f
Commit
f038253f
authored
Jun 25, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
清除swagger的ObjectMapper,它影响了全局的Jackson与Java对象序列化的转化规则
parent
bffa035a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
20 deletions
+3
-20
SwaggerConfig.java
...java/cn/quantgroup/xyqb/config/swagger/SwaggerConfig.java
+3
-20
No files found.
src/main/java/cn/quantgroup/xyqb/config/swagger/SwaggerConfig.java
View file @
f038253f
package
cn
.
quantgroup
.
xyqb
.
config
.
swagger
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.google.common.base.Predicates
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Component
;
import
com.google.common.base.Predicates
;
import
io.swagger.annotations.ApiOperation
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
...
...
@@ -53,17 +48,5 @@ public class SwaggerConfig {
.
version
(
"2.0"
)
.
build
();
}
@Component
@Primary
public
class
CustomObjectMapper
extends
ObjectMapper
{
public
CustomObjectMapper
()
{
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
configure
(
SerializationFeature
.
FAIL_ON_EMPTY_BEANS
,
false
);
configure
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
,
false
);
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
enable
(
SerializationFeature
.
INDENT_OUTPUT
);
}
}
}
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