2020 SpringBoot 连接腾讯云物联网平台,建项目、产品、设备

目录

1.Maven pom引入腾讯云SDK

2. 配置application.yml

3.创建TencentConfig 类

4.封装一个 TencentApi 类

5.新建Test 测试类


 

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值