目录
1.Maven pom引入腾讯云SDK
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<!-- go to https://search.maven.org/search?q=tencentcloud-sdk-java and get the latest version. -->
<!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询最新版本 -->
<version>3.1.88</version>
</dependency>
2. 配置application.yml
tencent:
secretId: xxxxx //申请secretId
secretKey: xxxxx //申请secretKey
endpoint: iotexplorer.tencentcloudapi.com
region: ap-shanghai
3.创建TencentConfig 类
package com.example.demo.tencent;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* Created with IntelliJ IDEA.
*
* @Auther: ljt
* @Version 1.0
* @Date: 2020/07/10/14:08
* @Description:
*/
@Component
@PropertySource("classpath:application.yml")
@ConfigurationProperties(prefix = "tencent")
@Data
public class TencentConfig {
@Value("${secretId}")
private String secretId;
@Value("${secretKey}")
private String secretKey;
@Value("${endpoint}")
private String endpoint;
@Value("${region}")
private String re