Browse Source

redisson连接添加用户名

mac 2 years ago
parent
commit
7767416166

+ 3 - 0
kxs-common/kxs-common-idempotent/src/main/java/com/kxs/common/idempotent/IdempotentAutoConfiguration.java

@@ -57,6 +57,9 @@ public class IdempotentAutoConfiguration {
 	public RedissonClient redissonClient() {
 		Config config = new Config();
 		config.useSingleServer().setAddress(redisProperties.getPrefix() + redisProperties.getHost() + ":" + redisProperties.getPort());
+		if(StrUtil.isNotBlank(redisProperties.getUsername())){
+			config.useSingleServer().setUsername(redisProperties.getUsername());
+		}
 		if(StrUtil.isNotBlank(redisProperties.getPassword())){
 			config.useSingleServer().setPassword(redisProperties.getPassword());
 		}

+ 5 - 0
kxs-common/kxs-common-idempotent/src/main/java/com/kxs/common/idempotent/config/RedisProperties.java

@@ -21,6 +21,11 @@ public class RedisProperties {
      */
     private String host;
 
+    /**
+     * username
+     */
+    private String username;
+
     /**
      * pwd
      */