Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dict
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈文顺
dict
Commits
2e51a077
Commit
2e51a077
authored
Nov 12, 2018
by
陈文顺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fastJson支持全序列化,需要打开SerializerFeature.WriteClassName特性
parent
003cb2fe
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
demo-service/src/main/java/com/freemud/demo/util/FastJsonRedisSerializer.java
+4
-4
demo-service/src/main/java/com/freemud/demo/util/RedisConfig.java
+1
-1
pom.xml
+1
-1
No files found.
demo-service/src/main/java/com/freemud/demo/util/FastJsonRedisSerializer.java
View file @
2e51a077
...
...
@@ -15,10 +15,10 @@ public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
public
static
final
Charset
DEFAULT_CHARSET
=
Charset
.
forName
(
"UTF-8"
);
private
Class
<
T
>
clazz
;
//
private Class<T> clazz;
public
FastJsonRedisSerializer
(
Class
<
T
>
clazz
)
{
this
.
clazz
=
clazz
;
public
FastJsonRedisSerializer
()
{
//
this.clazz = clazz;
}
@Override
...
...
@@ -36,6 +36,6 @@ public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
return
null
;
}
String
str
=
new
String
(
bytes
,
DEFAULT_CHARSET
);
return
(
T
)
JSON
.
parse
Object
(
str
,
clazz
);
return
(
T
)
JSON
.
parse
(
str
);
}
}
demo-service/src/main/java/com/freemud/demo/util/RedisConfig.java
View file @
2e51a077
...
...
@@ -16,7 +16,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
public
class
RedisConfig
{
@Bean
public
RedisSerializer
getFastJsonRedisSerializer
()
{
return
new
FastJsonRedisSerializer
(
Object
.
class
);
return
new
FastJsonRedisSerializer
();
}
@Bean
...
...
pom.xml
View file @
2e51a077
...
...
@@ -28,7 +28,7 @@
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<java.version>
1.8
</java.version>
<spring-cloud.version>
Edgware.SR2
</spring-cloud.version>
<mybatis3.version>
1.3.
0
</mybatis3.version>
<mybatis3.version>
1.3.
2
</mybatis3.version>
<mapper.version>
1.1.1
</mapper.version>
</properties>
...
...
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