From 2807946f26d2f8b99147e4625faa326567b066d7 Mon Sep 17 00:00:00 2001 From: fuqingji <51312040@qq.com> Date: Thu, 28 Jul 2022 09:24:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9redis=E7=9A=84db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../starter/service/impl/UserInfoServiceImpl.java | 2 +- .../ebtp/common/config/RedisLettuceConfig.java | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/cloud/userinfo/starter/service/impl/UserInfoServiceImpl.java b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/cloud/userinfo/starter/service/impl/UserInfoServiceImpl.java index c0739b6..120b499 100644 --- a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/cloud/userinfo/starter/service/impl/UserInfoServiceImpl.java +++ b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/cloud/userinfo/starter/service/impl/UserInfoServiceImpl.java @@ -33,7 +33,7 @@ public class UserInfoServiceImpl implements UserInfoService { // private @Autowired ObjectMapper userInfoObjectMapper; @Autowired(required = false) - @Qualifier("cacheRedisTemplate") + @Qualifier("userinfoRedisTemplate") private RedisTemplate redisTemplate; @Autowired diff --git a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/config/RedisLettuceConfig.java b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/config/RedisLettuceConfig.java index 57cd2e4..fe6f043 100644 --- a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/config/RedisLettuceConfig.java +++ b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/config/RedisLettuceConfig.java @@ -44,28 +44,28 @@ public class RedisLettuceConfig { private final RedisProperties redisProperties; - @Bean("idempotentRedisTemplate") + @Bean("idempotentRedisTemplate") //3 @ConditionalOnProperty(name = "spring.redis.database.idempotent") public RedisTemplate idempotentRedisTemplate(@Value("${spring.redis.database.idempotent}") int idempotentDatabase) { return this.redisTemplate(this.getLettuceConnectionFactory(idempotentDatabase)); } - @Bean("shardingRedisTemplate") + @Bean("shardingRedisTemplate") //1 @ConditionalOnProperty(name = "spring.redis.database.sharding") public RedisTemplate shardingRedisTemplate(@Value("${spring.redis.database.sharding}") int shardingDatabase) { return this.redisTemplate(this.getLettuceConnectionFactory(shardingDatabase)); } - @Bean("cacheRedisTemplate") + @Bean("cacheRedisTemplate")//2 @ConditionalOnProperty(name = "spring.redis.database.cache") public RedisTemplate cacheRedisTemplate(@Value("${spring.redis.database.cache}") int cacheDatabase) { return this.redisTemplate(this.getLettuceConnectionFactory(cacheDatabase)); } - @Bean("backupRedisTemplate") - @ConditionalOnProperty(name = "spring.redis.database.backup") - public RedisTemplate backupRedisTemplate(@Value("${spring.redis.database.backup}") int backupDatabase) { - return this.redisTemplate(this.getLettuceConnectionFactory(backupDatabase)); + @Bean("userinfoRedisTemplate")//4 + @ConditionalOnProperty(name = "spring.redis.database.userinfo") + public RedisTemplate backupRedisTemplate(@Value("${spring.redis.database.userinfo}") int userinfoDatabase) { + return this.redisTemplate(this.getLettuceConnectionFactory(userinfoDatabase)); } private LettuceConnectionFactory getLettuceConnectionFactory(Integer db) {