Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ca625cb2
authored
Jul 13, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…
…oject.git into develop
2 parents
970bf042
0ff0fc7b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
project-user/src/main/java/com/dituhui/pea/user/commom/RedisConfig.java
project-user/src/main/java/com/dituhui/pea/user/commom/RedisConfig.java
View file @
ca625cb
...
@@ -7,15 +7,24 @@ import org.springframework.data.redis.core.RedisTemplate;
...
@@ -7,15 +7,24 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer
;
import
org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonTypeInfo
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
@Configuration
@Configuration
public
class
RedisConfig
{
public
class
RedisConfig
{
@Bean
@Bean
public
RedisTemplate
<
String
,
Object
>
redisTemplate
(
RedisConnectionFactory
connectionFactory
)
{
public
RedisTemplate
<
String
,
Object
>
redisTemplate
(
RedisConnectionFactory
connectionFactory
)
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
objectMapper
.
activateDefaultTyping
(
objectMapper
.
getPolymorphicTypeValidator
(),
ObjectMapper
.
DefaultTyping
.
EVERYTHING
,
JsonTypeInfo
.
As
.
PROPERTY
);
RedisTemplate
<
String
,
Object
>
redisTemplate
=
new
RedisTemplate
<>();
RedisTemplate
<
String
,
Object
>
redisTemplate
=
new
RedisTemplate
<>();
redisTemplate
.
setConnectionFactory
(
connectionFactory
);
redisTemplate
.
setConnectionFactory
(
connectionFactory
);
redisTemplate
.
setKeySerializer
(
new
StringRedisSerializer
());
redisTemplate
.
setKeySerializer
(
new
StringRedisSerializer
());
redisTemplate
.
setValueSerializer
(
new
GenericJackson2JsonRedisSerializer
());
redisTemplate
.
setValueSerializer
(
new
GenericJackson2JsonRedisSerializer
(
objectMapper
));
return
redisTemplate
;
return
redisTemplate
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment