Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 解决强制依赖redis错误 #2015

Merged
merged 1 commit into from
Feb 26, 2021
Merged

Conversation

huayanYu
Copy link

如果不使用Redis,如只使用redisson作为storage,则会在打包后报错。
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig

相关ISSUE
#1973
#1956

最小化示例项目 https://github.com/huayanYu/wxjava-mini-demo mvn test 即可复现。

分析原因: 不太确定,没仔细研究spring源码,大概是因为配置类里会用到JedisPool,所以会去查找相关类。
放到内部类通过静态方法调用则不会。

另外的解决办法
我的多数据源单独配了一个独立Configuration先通过判断所有能加入的,放到一个池子里。 然后再要使用的地方注入这个池子,去这个池子里取。 不过本项目要改造,工作量有些大。 也不一定是最合适的方案。 可以参考讨论。
https://github.com/baomidou/dynamic-datasource-spring-boot-starter/blob/master/src/main/java/com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceCreatorAutoConfiguration.java

@binarywang binarywang added this to the 4.0.6 milestone Feb 26, 2021
@binarywang binarywang merged commit da512ff into Wechat-Group:develop Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants