Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
如果不使用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