Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
9015cae9
Commit
9015cae9
authored
May 24, 2022
by
Zheng Jie
Browse files
fastjson 升级到 1.2.83 后需要指定序列化白名单
parent
3ed53836
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java
View file @
9015cae9
...
...
@@ -80,10 +80,18 @@ public class RedisConfig extends CachingConfigurerSupport {
// value值的序列化采用fastJsonRedisSerializer
template
.
setValueSerializer
(
fastJsonRedisSerializer
);
template
.
setHashValueSerializer
(
fastJsonRedisSerializer
);
// 全局开启AutoType,这里方便开发,使用全局的方式
ParserConfig
.
getGlobalInstance
().
setAutoTypeSupport
(
true
);
// 建议使用这种方式,小范围指定白名单
// ParserConfig.getGlobalInstance().addAccept("me.zhengjie.domain");
// fastjson 升级到 1.2.83 后需要指定序列化白名单
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.domain"
);
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.service.dto"
);
// 模块内的实体类
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.modules.mnt.domain"
);
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.modules.quartz.domain"
);
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.modules.system.domain"
);
// 模块内的 Dto
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.modules.mnt.service.dto"
);
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.modules.quartz.service.dto"
);
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.modules.security.service.dto"
);
ParserConfig
.
getGlobalInstance
().
addAccept
(
"me.zhengjie.modules.system.service.dto"
);
// key的序列化采用StringRedisSerializer
template
.
setKeySerializer
(
new
StringRedisSerializer
());
template
.
setHashKeySerializer
(
new
StringRedisSerializer
());
...
...
Write
Preview
Supports
Markdown
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