java阿里短信接口调用

本文详细介绍了如何使用Java调用阿里云短信接口,包括导入所需jar包、创建阿里云用户Key、编写工具类、Controller类以及前端页面和JS实现。通过Ajax实现前端获取验证码并设置60秒时间限制。
摘要由CSDN通过智能技术生成

一、导入jar包

   <dependency>

       <groupId>com.aliyun.mns</groupId>

       <artifactId>aliyun-sdk-mns</artifactId>

       <version>1.1.8</version>

   </dependency>

   <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore-nio -->

   <dependency>

       <groupId>org.apache.httpcomponents</groupId>

       <artifactId>httpcore-nio</artifactId>

       <version>4.4.10</version>

   </dependency>

   <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->

   <dependency>

       <groupId>org.apache.httpcomponents</groupId>

       <artifactId>httpclient</artifactId>

       <version>4.5.6</version>

   </dependency>

   <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->

   <dependency>

       <groupId>org.apache.httpcomponents</groupId>

       <artifactId>httpcore</artifactId>

       <version>4.4.10</version>

   </dependency>

   <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpasyncclient -->

   <dependency>

       <groupId>org.apache.httpcomponents</groupId>

       <artifactId>httpasyncclient</artifactId>

       <version>4.1.4</version>

   </dependency>

  

   <!-- gao阿里短信 -->

   <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core -->

   <dependency>

       <groupId>com.aliyun</groupId>

       <artifactId>aliyun-java-sdk-core</artifactId>

       <version>3.3.1</version>

   </dependency>

   <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-dysmsapi -->

   <dependency>

       <groupId>com.aliyun</groupId>

       <artifactId>aliyun-java-sdk-dysmsapi</artifactId>

       <version>1.0.0</version>

   </dependency>

二、登陆阿里云
在这里插入图片描述
创建用户key等内容

https://help.aliyun.com/document_detail/59210.html?spm=a2c4g.11174283.4.1.meieQd
在这里插入图片描述
该步骤一步一步的创建
代码:

创建 工具类
package com.bjsxt.utils;

import
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值