WxJava is a comprehensive Java SDK for the WeChat ecosystem, providing client libraries for Official Accounts (MP), Mini Programs (MiniApp), Enterprise WeChat (CP), WeChat Pay, Open Platform, Video Channels, and more. It is designed as a multi-module library to be embedded in Java applications, with first-class support for Spring Boot and Solon frameworks via auto-configuration starters. The SDK abstracts HTTP client backends (Apache, OkHttp, Jodd, HttpComponents), provides Redis-based config storage for distributed token management, and implements multi-tenant patterns for managing multiple WeChat accounts. It handles the full lifecycle of WeChat API integration: request signing, serialization (Gson/Jackson/XStream), message routing, and callback verification. The codebase is large and well-structured, though it shows signs of duplication across modules and mixed serialization frameworks, reflecting organic growth over time.
This repository is a Spring Boot-based demo application for integrating with WeChat Pay APIs. It provides REST endpoints demonstrating various WeChat Pay functionalities including payment processing, refunds, enterprise payments, red packet distribution, and coupon handling for both V2 and V3 versions of the WeChat Pay API. The application uses the WxJava library to handle the actual communication with WeChat's servers. The architecture follows standard Spring Boot MVC patterns with controllers handling HTTP requests, delegating to the WxPayService from WxJava for business logic, and returning formatted responses. Configuration is managed through application.yml using Spring Boot's @ConfigurationProperties, with a dedicated configuration class setting up the WxJava service as a Spring bean. The project includes Swagger for API documentation and basic error handling via custom error pages. While the code demonstrates solid enterprise Java practices with proper dependency injection, configuration separation, and API documentation, it is primarily intended as a learning tool rather than a production-ready library. The controllers contain TODO comments indicating areas where users need to implement their own business logic, and some dependencies (particularly Springfox for Swagger) are outdated relative to current Spring Boot versions.