2

With Earlier version 5.1.6.RELEASE , withPassword works perfectly. How ever with latest version it shows warning that withPassword is deprecated.It takes Array[Char] or charSequence .

  @transient lazy val redisClient = RedisClient.create(
    RedisURI.builder()
      .withHost(redisHost)
      .withPort(redisPort)
      .withPassword(redisAuth)
      .withSsl(true)
      .build()
TobiSH
  • 2,833
  • 3
  • 23
  • 33
CoolGoose
  • 140
  • 10

1 Answers1

3

According to the documentation you shouldn't use the withPassword method taking a String as a parameter but use a CharSequence or an Array[Char]

  • @deprecated since 6.0. Use {@link #withPassword(CharSequence)} or {@link #withPassword(char[])} avoid String caching.

See also the api docs or the plain comments at the source code.

So if simply change your code to

@transient lazy val redisClient = RedisClient.create(
    RedisURI.builder()
      .withHost(redisHost)
      .withPort(redisPort)
      .withPassword(redisAuth.toCharArray)
      .withSsl(true)
      .build()

you will at least avoid the warning (but kind of workaround the reason why the introduced that deprecatation). Maybe this question + answers is worth reading: Why is char[] preferred over String for passwords?.

TobiSH
  • 2,833
  • 3
  • 23
  • 33