Skip to content

fix(wx-java-mp): 对齐 MiniApp 的 Redis host 默认值 - #4148

Open
miemieYaho wants to merge 8 commits into
binarywang:developfrom
miemieYaho:codex/wxmp-redis-host-default
Open

miemieYaho wants to merge 8 commits into
binarywang:developfrom
miemieYaho:codex/wxmp-redis-host-default

Conversation

@miemieYaho

Copy link
Copy Markdown

变更

将公众号 Spring Boot Starter 的 Redis host 默认值改为 null,与 MiniApp 对齐。应用已经提供 RedissonClient 时,只设置 wx.mp.config-storage.type=redisson 即可复用该客户端。

- private String host = "127.0.0.1";
+ private String host;

MiniApp 的 RedisProperties.host 没有初始值。省略 host 时,MiniApp 按类型查找应用已有的 RedissonClient。MP 原有代码也有相同的回退分支,但默认的 127.0.0.1 会让查找误入专用客户端分支。此时 wxMpRedissonClient 因缺少 host 配置而没有注册,导致 WxMpService 初始化失败。

显式配置有效 host 时,MP 仍由 Spring 创建并管理专用客户端。MP 的 Jedis 模式也使用同一个 host 属性,省略 host 时会复用应用提供的 JedisPool。

验证

mvn -pl spring-boot-starters/wx-java-mp-spring-boot-starter -am -DskipTests compile 编译通过。

替代 #4147。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T09:40:44.734154Z c00082c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c00082c48c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

* 主机地址.
*/
private String host = "127.0.0.1";
private String host;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 说明省略 Redis host 时的客户端复用契约

在 wx.mp.config-storage.type=jedis/redisson 场景,此行把“省略 host”变成复用容器中客户端的配置契约,但该模块的 README.md 仍只给出显式的 host=127.0.0.1,当前字段说明也没有说明省略值需要现有客户端;发布后用户无法从随包文档得知新用法,并会在容器中没有相应 bean 时直到启动阶段才看到失败。请同步补充 host 的省略语义及前置条件。

AGENTS.md reference: AGENTS.md:L89-L89

Useful? React with 👍 / 👎.

* 主机地址.
*/
private String host = "127.0.0.1";
private String host;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 为 Redis 客户端回退增加回归测试

该修改通过把 host 默认值设为 null 来切换 WxMpInRedissonConfigStorageConfiguration 和 WxMpInJedisConfigStorageConfiguration 的 bean 查找分支,但受影响模块当前没有测试覆盖“省略 host 且容器已有客户端”的启动场景;以后默认值或分支改动时,原来的 NoSuchBeanDefinitionException 可以直接回归而 CI 无法发现。请添加最小 Spring 上下文回归测试,至少验证未配置 host 时会复用已有 RedissonClient,并覆盖同一字段影响的 Jedis 分支。

AGENTS.md reference: AGENTS.md:L64-L64

Useful? React with 👍 / 👎.

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.

1 participant