Skip to content

fix(wx-java-mp): 修复 Spring Boot Starter 的 Redisson 客户端回退 - #4147

Closed
miemieYaho wants to merge 2 commits into
binarywang:developfrom
miemieYaho:codex/wxmp-redisson-fallback
Closed

miemieYaho wants to merge 2 commits into
binarywang:developfrom
miemieYaho:codex/wxmp-redisson-fallback

Conversation

@miemieYaho

Copy link
Copy Markdown

问题

公众号 Spring Boot Starter 配置 wx.mp.config-storage.type=redisson 且省略 wx.mp.config-storage.redis.host 时,RedisProperties 的默认 host 会让客户端查找走到 wxMpRedissonClient。该 Bean 没有注册,导致 WxMpService 初始化失败。Solon 插件的同类问题已在 #4048 修复。

修改

  • 仅在显式配置非空白且非 false 的 host 时注册公众号专用 Redisson 客户端。
  • 专用 Bean 存在时按名称取用,否则按类型复用应用提供的 RedissonClient。保留 RedisProperties 的默认值,避免影响其他存储策略。

验证

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

@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:03:10.770611Z f0562b4 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: f0562b4baa

ℹ️ 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".

@Bean
@ConditionalOnProperty(prefix = WxMpProperties.PREFIX + ".config-storage.redis", name = "host")
@Bean(REDISSON_CLIENT_BEAN)
@Conditional(RedisHostConfiguredCondition.class)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 为 Redisson 回退分支补充回归测试

这次修复的核心依赖于 Spring 解析 @Conditional 后是否注册 wxMpRedissonClient,但提交中没有任何测试覆盖,现有的 compile 验证不会执行这里的条件或 bean 查找。请至少用应用上下文分别覆盖“省略 redis.host 且应用提供 RedissonClient”和“显式配置 host 后创建专用 bean”的启动场景,否则原始初始化失败很容易在后续改动中回归。

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