There is one AutoConfiguration class call WxMpStorageAutoConfiguration, include method private JedisPool getJedisPool(){} and the JedisPool dependency is provided, when spring boot runing, It's will reflected the private method, will raise ClassNotFoundException.

enviroments

  • spring-boot: 2.2.2-RELEASE
  • jdk: 1.8.0_232

code

springboot The private method of the auto configuration class will be reflected, causing the provided dependency to be thrown java.lang.ClassNotFoundException

springboot The private method of the auto configuration class will be reflected, causing the provided dependency to be thrown java.lang.ClassNotFoundException

springboot The private method of the auto configuration class will be reflected, causing the provided dependency to be thrown java.lang.ClassNotFoundException

detail: https://paste.ubuntu.com/p/zd8SFysPXh/

Comment From: snicoll

WxMpStorageAutoConfiguration seems to be part of this project. I am assuming that you mean when JedisPool isn't provided, right?

You should raise an issue in that project so they had the necessary condition to backoff when Jedis isn't on the classpath.

Comment From: lkqm

No, I wite WxMpStorageAutoConfigurationis part of this project. It is clear that jedis dependency is optional. The problem is that why spring boot will reflect all private methods in the auto configuration class when loading, which will be reflected through the reflectutils tool class. Thanks.

Comment From: snicoll

If you are the author, you need to put @ConditionalOnClass to guard the JVM from scanning signatures and failing the way it does now. Spring Boot doesn't do that.