Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

实现计划

  • 理解问题:当前 wx-open-starter 只支持单个微信开放平台配置,需要支持多个第三方平台
  • 分析现有实现:研究 wx-java-mp-multi-spring-boot-starter 的多账号模式
  • 创建新模块 wx-java-open-multi-spring-boot-starter
    • 创建模块目录结构
    • 创建 pom.xml 文件
    • 创建属性配置类(Properties)
    • 创建服务管理类(MultiServices)
    • 创建配置类(Configuration)
    • 创建自动配置类(AutoConfiguration)
    • 创建存储配置类(Storage Configurations)
    • 创建 Spring Boot 自动配置文件
    • 创建 README.md 文档
  • 更新父 pom.xml,将新模块加入构建列表
  • 编译和测试
    • 运行完整编译验证
    • 运行 checkstyle 验证
    • 运行完整打包验证
  • 代码审查和安全检查
    • 第一轮代码审查反馈修复
    • 第二轮代码审查反馈修复
      • 修改 StorageType 枚举为小写命名(memory, jedis, redisson, redistemplate)
      • 修改 HttpClientType 枚举为小写命名(httpclient)
      • 更新所有作者信息为 "Binary Wang"
      • 更新 README.md 文档中的枚举值说明
      • 修复枚举默认值引用

变更说明

根据代码审查反馈,对枚举命名进行了统一规范:

  1. StorageType 枚举:从大写改为小写(MEMORY → memory, JEDIS → jedis, REDISSON → redisson, REDIS_TEMPLATE → redistemplate)
  2. HttpClientType 枚举:从大写改为小写(HTTP_CLIENT → httpclient),与单账号版本保持一致
  3. 作者信息:统一更新为 "Binary Wang"
  4. 文档更新:README.md 中的配置说明已更新为小写枚举值

这些修改确保了与项目现有 wx-java-open-spring-boot-starter 单账号版本的命名风格保持一致。

Original prompt

This section details on the original issue you should resolve

<issue_title>如果一个项目想要接多个第三方平台,wx-open-starter好像不支持</issue_title>
<issue_description>如果一个项目想要接多个第三方平台,wx-open-starter好像不支持</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: 全部用中文
需要用中文,包括PR标题和分析总结过程


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix support for multiple third-party platforms in wx-open-starter 新增 wx-java-open-multi-spring-boot-starter 支持多开放平台配置 Jan 14, 2026
Copilot AI requested a review from binarywang January 14, 2026 04:04
@binarywang binarywang marked this pull request as ready for review January 14, 2026 04:05
Copilot AI review requested due to automatic review settings January 14, 2026 04:05
@augmentcode
Copy link

augmentcode bot commented Jan 14, 2026

🤖 Augment PR Summary

PR 总结:本次 PR 新增了 wx-java-open-multi-spring-boot-starter,用于在同一项目中支持多个微信开放平台(第三方平台)配置与按租户获取对应 WxOpenService

主要变更:

  • spring-boot-starters/pom.xml 中新增 wx-java-open-multi-spring-boot-starter 子模块
  • 新增多账号属性模型:WxOpenMultiProperties + wx.open.apps.{tenantId}.* 的配置方式
  • 新增服务管理接口与实现:WxOpenMultiServices/WxOpenMultiServicesImpl,通过 tenantId 获取对应 WxOpenService
  • 新增自动装配入口与配置聚合:WxOpenMultiAutoConfigurationWxOpenMultiServiceConfiguration
  • 提供 4 种 ConfigStorage 策略:memory、jedis、redisson、redis_template(基于条件装配切换)
  • 在初始化阶段增加 appId 唯一性校验与必填参数校验(appId/secret),避免多租户下 token/ticket 缓存冲突
  • 支持统一配置 Redis key 前缀、HTTP 代理与重试/超时等参数,并写入 starter README 示例

技术要点:整体实现参考了现有 multi-starter 模式,将每个租户的 app 配置装配成独立的 WxOpenService 实例并集中管理。

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

wx.open.config-storage.key-prefix=wx:open:multi
wx.open.config-storage.redis.host=127.0.0.1
wx.open.config-storage.redis.port=6379
## 单机和 sentinel 同时存在时,优先使用sentinel配置
Copy link

Choose a reason for hiding this comment

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

README 这里提到“单机和 sentinel 同时存在时优先使用 sentinel”,但当前 starter 的 Jedis/Redisson 实现并未读取 sentinel-ips/sentinel-name,按文档配置可能仍不会生效,建议补充说明避免误导。

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Copy link
Owner

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

*/
protected abstract WxOpenInMemoryConfigStorage wxOpenConfigStorage(WxOpenMultiProperties wxOpenMultiProperties);

public WxOpenService wxOpenService(WxOpenConfigStorage configStorage, WxOpenMultiProperties wxOpenMultiProperties) {
Copy link

Choose a reason for hiding this comment

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

这里创建 WxOpenService 时始终使用 WxOpenServiceImplwx.open.config-storage.http-client-type(以及 WxOpenMultiProperties.ConfigStorage#httpClientType)目前不会影响实际客户端选择,可能让使用方误以为可切换实现。

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Copy link
Owner

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

binarywang and others added 10 commits January 14, 2026 17:06
…c/main/java/com/binarywang/spring/starter/wxjava/open/configuration/services/WxOpenInJedisConfiguration.java

Co-authored-by: Copilot <[email protected]>
…c/main/java/com/binarywang/spring/starter/wxjava/open/properties/WxOpenSingleProperties.java

Co-authored-by: Copilot <[email protected]>
…c/main/java/com/binarywang/spring/starter/wxjava/open/properties/WxOpenMultiProperties.java

Co-authored-by: Copilot <[email protected]>
…c/main/java/com/binarywang/spring/starter/wxjava/open/properties/WxOpenMultiProperties.java

Co-authored-by: Copilot <[email protected]>
…c/main/java/com/binarywang/spring/starter/wxjava/open/service/WxOpenMultiServices.java

Co-authored-by: Copilot <[email protected]>
…c/main/java/com/binarywang/spring/starter/wxjava/open/configuration/services/WxOpenInMemoryConfiguration.java

Co-authored-by: Copilot <[email protected]>
…c/main/java/com/binarywang/spring/starter/wxjava/open/configuration/services/WxOpenInRedissonConfiguration.java

Co-authored-by: Copilot <[email protected]>
…c/main/java/com/binarywang/spring/starter/wxjava/open/configuration/services/WxOpenInRedisTemplateConfiguration.java

Co-authored-by: Copilot <[email protected]>
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.

如果一个项目想要接多个第三方平台,wx-open-starter好像不支持

2 participants