特别赞助
赞助商招募中,欢迎联系合作(联系方式见下方 社区交流与支持)。
核心特性
- 全生态微信服务端能力:覆盖微信公众号、微信小程序、微信支付(V2/V3)、企业微信、开放平台、视频号、微信小店等主流微信业务模块。
- 主流框架开箱即用:内置官方 Spring Boot Starters(支持单账号与多账号)和 Solon Plugins,同时提供 Quarkus 集成指南 与 GraalVM Native Image 辅助支持(
weixin-graal)。
- 灵活的存储与 HTTP 适配:支持 Memory、Jedis、RedisTemplate、Redisson 等多配置存储,支持 Apache HttpClient 4.x / 5.x、OkHttp、Jodd-Http 切换。
- 统一版本管理:提供
wx-java-bom 统一管理多模块依赖版本,基础环境要求 JDK 8+。
- 原生 AI 编程支持:内置面向 AI 编程智能体的 5 个标准
SKILL,辅助模块选型、项目接入、故障排查、接口贡献与升级迁移。
模块选型
| 业务场景 |
核心模块 (artifactId) |
Spring Boot Starter(单账号 / 多账号) |
Solon Plugin |
| 微信公众号 |
weixin-java-mp |
wx-java-mp-spring-boot-starter / wx-java-mp-multi-spring-boot-starter |
wx-java-mp-solon-plugin / wx-java-mp-multi-solon-plugin |
| 微信小程序 |
weixin-java-miniapp |
wx-java-miniapp-spring-boot-starter / wx-java-miniapp-multi-spring-boot-starter |
wx-java-miniapp-solon-plugin / wx-java-miniapp-multi-solon-plugin |
| 微信支付(V2/V3) |
weixin-java-pay |
wx-java-pay-spring-boot-starter / wx-java-pay-multi-spring-boot-starter |
wx-java-pay-solon-plugin |
| 企业微信 |
weixin-java-cp |
wx-java-cp-spring-boot-starter / wx-java-cp-multi-spring-boot-starter / wx-java-cp-tp-multi-spring-boot-starter |
wx-java-cp-solon-plugin / wx-java-cp-multi-solon-plugin |
| 微信开放平台(第三方平台) |
weixin-java-open |
wx-java-open-spring-boot-starter / wx-java-open-multi-spring-boot-starter |
wx-java-open-solon-plugin |
| 微信视频号 |
weixin-java-channel |
wx-java-channel-spring-boot-starter / wx-java-channel-multi-spring-boot-starter |
wx-java-channel-solon-plugin / wx-java-channel-multi-solon-plugin |
| 微信小店(独立新模块) |
weixin-java-store |
wx-java-store-spring-boot-starter / wx-java-store-multi-spring-boot-starter |
wx-java-store-solon-plugin / wx-java-store-multi-solon-plugin |
- 微信小店模块说明:微信小店已拆分为独立模块
weixin-java-store,原有 weixin-java-channel 中的小店接口已标记为 @Deprecated,迁移方式详见 微信小店模块迁移指南。
- 移动应用(iOS/Android)接入说明:客户端登录、分享等能力需集成微信官方移动端 SDK,本项目为服务端 SDK;服务端 OAuth 网页授权可使用
weixin-java-open,支付使用 weixin-java-pay。weixin-java-open 主要用于第三方平台代公众号或小程序进行开发和管理。
展开查看扩展与辅助模块(企点 / 智能对话 / GraalVM / BOM)
| 场景 / 用途 |
artifactId |
配套集成 / 说明 |
| 腾讯企点 |
weixin-java-qidian |
对应 wx-java-qidian-spring-boot-starter、wx-java-qidian-solon-plugin |
| 微信智能对话 |
weixin-java-aispeech |
微信对话开放平台服务端 SDK |
| GraalVM Native Image |
weixin-graal |
配合生成 native-image 配置的辅助模块 |
| 依赖版本管理 |
wx-java-bom |
统一管理 WxJava 各核心模块与 Starter/Plugin 版本 |
快速开始
最新稳定版为 4.8.6(GitHub Releases ·
)。
1. 引入依赖
方式一:使用 BOM 统一管理版本(推荐,多模块场景)
wx-java-bom 从 4.8.3.B(正式版 4.8.4+)开始提供,导入后各模块与 Starter 无需重复指定版本号:
<properties>
<wx-java.version>4.8.6</wx-java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-bom</artifactId>
<version>${wx-java.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
之后按需引入核心模块或 Starter 即可:
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-pay-spring-boot-starter</artifactId>
</dependency>
方式二:直接引入单个模块 / Spring Boot Starter
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
<version>4.8.6</version>
</dependency>
Gradle(Groovy / Kotlin DSL)引入方式
Groovy DSL (build.gradle):
dependencies {
implementation platform('com.github.binarywang:wx-java-bom:4.8.6')
implementation 'com.github.binarywang:wx-java-mp-spring-boot-starter'
implementation 'com.github.binarywang:wx-java-pay-spring-boot-starter'
}
Kotlin DSL (build.gradle.kts):
dependencies {
implementation(platform("com.github.binarywang:wx-java-bom:4.8.6"))
implementation("com.github.binarywang:wx-java-mp-spring-boot-starter")
implementation("com.github.binarywang:wx-java-pay-spring-boot-starter")
}
2. 最小示例
Spring Boot Starter 示例:微信公众号(获取 AccessToken)
- 在
application.yml 中配置公众号参数:
wx:
mp:
app-id: your-app-id
secret: your-secret
- 直接注入
WxMpService 调用 API:
@RestController
@RequiredArgsConstructor
public class WxMpDemoController {
private final WxMpService wxMpService;
@GetMapping("/mp/token")
public String getToken() throws WxErrorException {
return wxMpService.getAccessToken();
}
}
Spring Boot Starter 示例:微信支付 V3(查询订单)
- 在
application.yml 中配置商户证书与 V3 密钥(V2 与服务商配置见 wx-java-pay-spring-boot-starter):
wx:
pay:
appId: your-app-id
mchId: your-mch-id
apiV3Key: your-api-v3-key
certSerialNo: your-cert-serial-no
privateKeyPath: classpath:cert/apiclient_key.pem
privateCertPath: classpath:cert/apiclient_cert.pem
- 注入
WxPayService 调用 V3 接口:
@Service
@RequiredArgsConstructor
public class WxPayDemoService {
private final WxPayService wxPayService;
public WxPayOrderQueryV3Result queryOrder(String outTradeNo) throws WxPayException {
return wxPayService.queryOrderV3(null, outTradeNo);
}
}
原生 Java 示例:公众号(MP)与小程序(MiniApp)
公众号(MP)获取 AccessToken:
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
config.setAppId("your-app-id");
config.setSecret("your-secret");
WxMpService wxMpService = new WxMpServiceImpl();
wxMpService.setWxMpConfigStorage(config);
String accessToken = wxMpService.getAccessToken();
System.out.println(accessToken);
小程序(MiniApp)code2Session:
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
config.setAppid("your-app-id");
config.setSecret("your-secret");
WxMaService wxMaService = new WxMaServiceImpl();
wxMaService.setWxMaConfig(config);
WxMaJscode2SessionResult result = wxMaService.getUserService().getSessionInfo("js-code");
System.out.println(result.getOpenid());
AI 编程 SKILL
仓库的 skills 目录提供面向 WxJava 用户和贡献者的通用 SKILL,以 SKILL.md 为入口,支持主流 AI 编程智能体直接安装使用。
支持远程安装 SKILL 的智能体,可直接使用自然语言指令安装,例如:
安装 https://github.com/binarywang/WxJava/tree/develop/skills/wxjava-integration-guide 中的技能。
可安装的 SKILL 包括:
重启或新建智能体会话后,即可按需触发,例如:使用 wxjava-integration-guide 为我的 Spring Boot 项目接入微信支付。
不支持远程安装?查看本地复制安装方式
可将所需的 skills/wxjava-* 目录复制到智能体的 SKILL 目录或工作区配置目录(具体目录请以其官方文档为准)。以 Codex 为例:
git clone https://github.com/binarywang/WxJava.git
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
cp -R WxJava/skills/wxjava-* "${CODEX_HOME:-$HOME/.codex}/skills/"
如果已在本仓库根目录,可直接执行:
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
cp -R skills/wxjava-* "${CODEX_HOME:-$HOME/.codex}/skills/"
文档与资源
核心文档与 Demo
专题指南(docs/)
在线 Javadoc
环境与源码说明
版本与发布说明
点此展开查看版本发布规则与各模块最新版本
- 正式版按需定期发布(如
4.8.0~4.8.6),发布时将 develop 分支合并至 release 分支并打正式版本号(X.Y.Z);遇到重大问题修复会及时发布新版本,欢迎提交 PR。
- 测试版版本号带
.B 后缀(如 4.8.6.B),对应 develop 分支中的开发版本。
- 普通
develop 提交仅执行测试,不自动发布;需要提前验证修复时,维护者可在 GitHub Actions 手动发布 x.x.x-时间戳 版本。
- 总包最新版本为
,也可直接查看各主要模块的 Central 仓库版本:
社区交流
公众号与技术交流群
想获取 QQ 群 / 微信群 / 钉钉企业群加入方式,或接收版本更新通知与微信开发技术文章,请扫码关注 WxJava 公众号(也可在微信中搜索 weixin-java-tools 或 WxJava):
- 钉钉技术交流群:
32206329(技术交流 2 群)、30294972(技术交流 1 群,已满)、35724728(通知群,实时同步 GitHub 变更记录)。
提问与反馈
- 有新功能需求、发现 BUG 或微信官方接口变更,欢迎在 GitHub Issues 提交反馈。
- 提问前请先查阅 开发文档 Wiki 的常见问题部分,并参考 提问的智慧;粘贴大段代码或异常堆栈时建议使用 Issue 代码块折叠(
<details>)或 GitHub Gist。
参与贡献
商务合作、赞赏与代码托管
应用案例
完整案例登记列表,请【访问这里】查看,欢迎登记更多的案例。
以下为节选的部分案例,点此展开查看
开源项目:
小程序:
- (京东)友家铺子,友家铺子店长版,京粉精选
- 喵星人贴吧助手(扫码关注)
- 树懒揽书+
- 广廉快线,鹏城巴士等
- 当燃挑战、sportlight轻灵运动
- 360考试宝典
- 民医台
- 来一团商家版
- 史必达(史丹利)
- 嘀嗒云印
- 维沃吼吼
- 王朝社区(比亚迪新能源社区)
- 极吼吼手机上门回收换新
- 未来信封
- 5G惠享
- 生菜wordpress转小程序
- 丽日购
公众号:
- 中国电信上海网厅(sh_189)
- E答平台
- 宁夏生鲜365
- 通服货滴
- 神龙养车
- 沃音乐商务智能
- 光环云社群
- 手机排队
- 全民约跑健身便利店
- 民医台
- YshopMall
- 好行景区直通车以及全国40多个公众号
- 我奥篮球公众号
- 未来信封官微
- 银川智云问诊
- 5G惠享
企业微信:
其他:
贡献者与社区荣誉
GitHub Stargazers over time
评论