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

修复无法切换到初始公众号配置的问题并完善了removeConfigStorage #1600

Merged
merged 2 commits into from
Jun 3, 2020

Conversation

rain7fine11
Copy link

简要描述

  • 使用springboot配置的单公众号工程,mpId=111,通过addConfigStorage添加新配置mpId=222,然后switchoverTo(222)转换到新配置,再切换回来switchoverTo(111)抛异常。
  • 调用removeConfigStorage删除配置时,如果删除了唯一配置或默认配置将导致异常。

模块版本情况

  • WxJava 模块名: weixin-java-mp
  • WxJava 版本号:3.8.0

详细描述

  • 调用setWxMpConfigStorage方法进行初始化配置时,尚无默认配置存于WxMpConfigStorageHolder中,所以get方法取到的只是默认值“default”而不是传入的mpId,再经过setMultiConfigStorages把“default”配置回WxMpConfigStorageHolder,导致出错。
public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider) {
    final String defaultMpId = WxMpConfigStorageHolder.get();
    this.setMultiConfigStorages(ImmutableMap.of(defaultMpId, wxConfigProvider), defaultMpId);
  }
  • 针对第二个问题添加了判断,根据情况打出warn日志。

@binarywang binarywang merged commit b52e676 into Wechat-Group:develop Jun 3, 2020
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