maven引入
<dependency> <groupId>com.luomor.pcsms</groupId> <artifactId>pcsms-spring-boot-starter</artifactId> <version>1.0.1</version> </dependency>
设置配置文件
sms: config-type: yamlblends: tag1: accessKeyId: testaccessKeySecret: testsignature: testtemplateId: testtemplateName: coderequestUrl: dysmsapi.aliyuncs.comtag2: appKey: testapp-secret: testsignature: 华为短信测试sender: 1template-id: teststatusCallBack: url: https://test.cn-north-4.test.com:443
方法使用
@RestController@RequestMapping("/test/")
publicclassTestController {
@RequestMapping("/")
publicvoidsend() {
SmsFactory.getSmsBlend("tag1").sendMessage("16811116667", "123456");
SmsFactory.getSmsBlend("tag2").sendMessage("16811116667", "000000");
}
}sms:
corePoolSize: 10maxPoolSize: 30queueCapacity: 50keepAliveSeconds: 60threadNamePrefix: sms-executor-shutdownStrategy: true