快速接入 UCloud Starter,如 usms,ufile等
- 在
pom.xml
里面添加公开仓库
<repositories> <repository> <id>developer-weapons-repository</id> <url>https://raw.githubusercontent.com/developer-weapons/repository/master</url> </repository> </repositories>
- 引入对应的包版本
<dependency> <groupId>com.github.developer.weapons</groupId> <artifactId>ucloud-spring-boot-starter</artifactId> <version>1.0.0</version> </dependency>
- 配置必备属性
spring.usms.publicKey=pk spring.usms.privateKey=pk spring.usms.projectId=id spring.usms.signContent=id
- 引入操作
@Autowired private USMSService usmsService; USMSMessage message = new USMSMessage(); message.setPhoneNumbers(Lists.newArrayList("PHONE")); message.setTemplateId("ID"); message.setTemplateParams(Lists.newArrayList("PARAM")); usmsService.send(message);
5 操作文件
@Autowired private UFileService uFileService; uFileService.upload("image url"); uFileService.upload(new FileInputStream(new File("")),"mimeType","fileName");