add redis config
This commit is contained in:
parent
4e5d7b12a1
commit
46da669271
@ -48,6 +48,10 @@
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-context</artifactId>
|
||||
|
||||
@ -33,6 +33,7 @@ public class RedisConfig {
|
||||
@Bean
|
||||
@SuppressWarnings("all")
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) throws UnknownHostException {
|
||||
log.info(">>>>>>>>>>start init redis config<<<<<<<<<<");
|
||||
// 为了开发方便,直接使用<String, Object>
|
||||
RedisTemplate<String, Object> template = new RedisTemplate();
|
||||
template.setConnectionFactory(redisConnectionFactory);
|
||||
@ -58,7 +59,7 @@ public class RedisConfig {
|
||||
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||
// 把所有的配置 set 进 template
|
||||
template.afterPropertiesSet();
|
||||
|
||||
log.info(">>>>>>>>>>redis config init success<<<<<<<<<<");
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user