In order to fix bug for spring cloud gateway 3.x, I need to upgrade spring cloud version, from Finchley.SR1 to 2021.0.1.

when i upgrade spring boot in 2.6.4, jedis 3.6.1, failed to start project .

The error message is as follows:

2022-03-14 18:16:29.885 [main] ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter:40 - 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.boot.autoconfigure.data.redis.JedisConnectionConfiguration.jedisPoolConfig(JedisConnectionConfiguration.java:114)

The following method did not exist:

    redis.clients.jedis.JedisPoolConfig.setMaxWait(Ljava/time/Duration;)V

The calling method's class, org.springframework.boot.autoconfigure.data.redis.JedisConnectionConfiguration, was loaded from the following location:

    jar:file:xxx.jar!/BOOT-INF/lib/spring-boot-autoconfigure-2.6.4.jar!/org/springframework/boot/autoconfigure/data/redis/JedisConnectionConfiguration.class

The called method's class, redis.clients.jedis.JedisPoolConfig, is available from the following locations:

    jar:file:xxx.jar!/BOOT-INF/lib/jedis-3.6.1.jar!/redis/clients/jedis/JedisPoolConfig.class

The called method's class hierarchy was loaded from the following locations:

    redis.clients.jedis.JedisPoolConfig: jar:file:xxx.jar!/BOOT-INF/lib/jedis-3.6.1.jar!/
    org.apache.commons.pool2.impl.GenericObjectPoolConfig: jar:file:xxx.jar!/BOOT-INF/lib/commons-pool2-2.9.0.jar!/
    org.apache.commons.pool2.impl.BaseObjectPoolConfig: jar:file:xxx.jar!/BOOT-INF/lib/commons-pool2-2.9.0.jar!/
    org.apache.commons.pool2.BaseObject: jar:file:xxx.jar!/BOOT-INF/lib/commons-pool2-2.9.0.jar!/


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.data.redis.JedisConnectionConfiguration and redis.clients.jedis.JedisPoolConfig

Finally I find, The latest changes are as follows:

https://github.com/spring-projects/spring-boot/commit/fe17be16e9177e7ff38cb0b5de1369d0358130ae

SpringBoot The following method did not exist:      redis.clients.jedis.JedisPoolConfig.setMaxWait(Ljava/time/Duration;)V

Why modify method setMaxWaitMillis to setMaxWait ?

I search jedis api doc, find that: Before jedis 2.3.0, method setMaxWait exists,

https://javadoc.io/doc/redis.clients/jedis/2.3.0/redis/clients/jedis/JedisPoolConfig.html

After jedis 2.3.0, method setMaxWait is gone.

In my original project, spring boot version is 2.0.4.RELEASE, jedis version is 2.9.0, it runs successfully.

Now I use spring boot in 2.6.4, jedis 3.6.1, it failed.

Please guide how to solve this problem.

Comment From: snicoll

This was done as part of #27642

In new feature releases, Spring Boot upgrades the newer feature releases of third party dependencies like this one. You should not expect to upgrade Spring Boot while keeping the same version of a third party dependency. The versions that Spring Boot supports are documented in in the reference guide. Rather than fixing those versions manually, we recommend using our dependency management.

If you have more questions, please follow-up on StackOverflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Comment From: linzengrui017

Thanks.

I also found relevant information:

https://docs.spring.io/spring-data/redis/docs/current/reference/html/#redis:connectors:jedis

SpringBoot The following method did not exist:      redis.clients.jedis.JedisPoolConfig.setMaxWait(Ljava/time/Duration;)V

It looks like when using spring boot 2.6.4, the version of jedis should be 3.7.1.

I tried it, but still failed.

I re-checked the jedis documentation and finally found that 3.8.0 started to have the method setMaxwait again.

https://javadoc.io/doc/redis.clients/jedis/3.8.0/redis/clients/jedis/JedisPoolConfig.html

SpringBoot The following method did not exist:      redis.clients.jedis.JedisPoolConfig.setMaxWait(Ljava/time/Duration;)V

I tried it, and it really works.

Conclusion: With jedis 3.8.0, this problem can be solved

Comment From: snicoll

Thanks for the follow-up but Jedis isn't the one impacted, Commons-pool2 is. None of this would happen if you used dependency management rather than fixing your own versions.