Java面试核心知识点笔记
其中囊括了JVM、锁、并发、Java反射、Spring原理、微服务、Zookeeper、数据库、数据结构等大量知识点。
Java中高级面试高频考点整理
最后分享Java进阶学习及面试必备的视频教学
import com.aliyuncs.profile.IClientProfile;
import com.tulian.cim6d.construction.config.PropertityConfig;
/**
-
@Auther: tarzan
-
@Date: 2018/5/29 10:49
-
@Description: 短信验证码测试
*/
@Component
public class SmsUtils {
/** 产品名称:云通信短信API产品,开发者无需替换 */
private static final String product = “Dysmsapi”;
/** 产品域名,开发者无需替换 */
private static final String domain = “dysmsapi.aliyuncs.com”;
/** 短信模板 */
private static final String templateCode = “SMS_190786463”;
/** 短信签名 */
private static final String smsSign = “比目鱼”;
// 以下为测试代码,随机生成验证码
private static int newcode;
@Autowired
private PropertityConfig propertityConfig;
public static int getNewcode() {
return newcode;
}
public static void setNewcode() {
newcode = (int) (Math.random() * 9999) + 100; // 每次调用生成一次四位数的随机数
}
public SendSmsResponse sendSms(String telephone, JSONObject param) throws ClientException {
// 可自助调整超时时间
System.setProperty(“sun.net.client.defaultConnectTimeout”, “10000”);
System.setProperty(“sun.net.client.defaultReadTimeout”, “10000”);
// 初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile(“cn-beijing”, propertityConfig.getAccessKeyId(), propertityConfig.getAccessKeySecret());
DefaultProfile.addEndpoint(“cn-beijing”, “cn-beijing”, product, domain);
IAcsClient acsClient = new DefaultAcsClient(profile);
// 组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
// 必填:待发送手机号
request.setPhoneNumbers(telephone);
// 必填:短信签名-可在短信控制台中找到
request.setSignName(smsSign);
// 必填:短信模板-可在短信控制台中找到
request.setTemplateCode(templateCode);
// 可选:模板中的变量替换JSON串,如模板内容为"亲爱的用户,您的验证码为${code}"时,此处的值为
request.setTemplateParam(param.toJSONString());
// 选填-上行短信扩展码(无特殊需求用户请忽略此字段)
// request.setSmsUpExtendCode(“90997”);
// 可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
// request.setOutId(“yourOutId”);
// hint 此处可能会抛出异常,注意catch
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
if (sendSmsResponse.getCode() != null && sendSmsResponse.getCode().equals(“OK”)) {
System.out.println(“短信发送成功!”);
} else {
System.out.println(“短信发送失败!”);
}
return sendSmsResponse;
}
// public static void main(String[] args) throws Exception {
setNewcode();
String code = Integer.toString(getNewcode());
String telephone = “18637983099”;
SendSmsResponse sendSms = sendSms(telephone, code);//填写你需要测试的手机号码
System.out.println(“短信接口返回的数据----------------”);
System.out.println(“Code=” + sendSms.getCode());
System.out.println(“Message=” + sendSms.getMessage());
最后
小编利用空余时间整理了一份《MySQL性能调优手册》,初衷也很简单,就是希望能够帮助到大家,减轻大家的负担和节省时间。
关于这个,给大家看一份学习大纲(PDF)文件,每一个分支里面会有详细的介绍。
这里都是以图片形式展示介绍,如要下载原文件以及更多的性能调优笔记(MySQL+Tomcat+JVM)!
面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)收录**