zjh
2025-03-17 1917e1b69a8480654c086df54e32b0be94a88e7d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.ltkj.web.controller.message;
 
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
 
 
@Configuration
public class ALiYunSMSConfig {
    //阿里云账号的accessKeyId
    //@Value("${aliyun.sms.accessKeyId}")
    private String accessKeyId="LTAI5t9M9q1QKm37sZtfp72Q";
    //阿里云账号的accessKeySecret
    //@Value("${aliyun.sms.accessKeySecret}")
    private String accessKeySecret="ZnjnAzrqUuikulr8mHXNKah39NMCOE";
    //短信服务访问的域名
    //@Value("${aliyun.sms.endpoint}")
    private String endpoint="dysmsapi.aliyuncs.com";
 
 
    public com.aliyun.dysmsapi20170525.Client createClient() throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 您的 AccessKey ID
                .setAccessKeyId(accessKeyId)
                // 您的 AccessKey Secret
                .setAccessKeySecret(accessKeySecret);
        // 访问的域名
        config.endpoint =endpoint ;
        return new com.aliyun.dysmsapi20170525.Client(config);
    }
}