# 微信api springboot 启动器 **Repository Path**: twoke/wechat_api_springboot_starter ## Basic Information - **Project Name**: 微信api springboot 启动器 - **Description**: 封装了 微信api的SpringBoot启动器 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2020-07-01 - **Last Updated**: 2021-12-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 微信API封装--SpringBoot启动器版 ## 开发环境 ```shell maven 3.5+ jdk 1.8+ SpringBoot 2.2.6 ``` ## 使用说明 ### 1. 安装启动器到本地仓库 **1.1 克隆源码** ```shell git clone https://gitee.com/twoke/wechat_api_springboot_starter.git ``` ![image-20200701224853459](README.assets/image-20200701224853459.png) **1.2 新建项目,导入模块** ​ 建议删除.git文件 ![image-20200701225120519](README.assets/image-20200701225120519.png) ![image-20200701225221062](README.assets/image-20200701225221062.png) 导入模块后的整体项目架构 ![image-20200701225323182](README.assets/image-20200701225323182.png)1. **1.3 安装到本地maven库** 1.安装wechat-sdk-spring-boot-autoconfiguration ![image-20200701225721321](README.assets/image-20200701225721321.png) 2.安装wechat-sdk-spring-boot-starter ![image-20200701225758763](README.assets/image-20200701225758763.png) ### 2.创建SpringBoot项目 **2.1 创建项目** 命名按照你的意思写,我随意 ![image-20200701230007465](README.assets/image-20200701230007465.png) **2.2 添加模块** 根据你自己的需求 ![image-20200701230111970](README.assets/image-20200701230111970.png) **2.3 结构** ![image-20200701230219502](README.assets/image-20200701230219502.png) ### 3.开始使用 **3.1 引入依赖** ```xml com.twoke wechat-sdk-spring-boot-starter 1.0.0 ``` **3.2 填写配置** 在application.yml中添加appid和私钥 ![image-20200701230749993](README.assets/image-20200701230749993.png) 填写完毕 ![image-20200701230858207](README.assets/image-20200701230858207.png) **3.3 创建控制层,快速实现获取微信接口的调用凭证** ```java /** * @author TwoKe * @desc 控制器 * @date 2020/7/1 */ @RestController public class TempController { /** * 启动器中微信授权的API操作类 */ @Autowired private IWeiXinAuthApi weiXinAuthApi; @RequestMapping("/getAccessToKen") public Map getAccessToken(){ //封装返回信息 Map map = new HashMap<>(); /* * 返回access_token */ String accessToken = weiXinAuthApi.getAccessToken(); map.put("access_token",accessToken); return map; } } ``` ![image-20200701232656980](README.assets/image-20200701232656980.png) 其他api方法将在后续推出,目前已集成的方法有 1. 订阅消息 2. 登录认证 3. 小程序码以及小程序二维码 4. 接口调用凭证的获取