# SpringBoot Starter 练习 **Repository Path**: weinidage/springboot_starter_practice ## Basic Information - **Project Name**: SpringBoot Starter 练习 - **Description**: No description available - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-03-17 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sms-spring-boot-starter #### 介绍 这份代码是参考掘金上的一个大神的,自己也做了一些修改,链接给出:https://juejin.im/post/5cb880c2f265da03981fc031 首先我以我的理解来简单介绍一下这个项目。 #### 项目基础类 SendSMSDTO:用于参数传递 RestTemplateConfig:用于调用短信接口(PS:它简化了与http服务的通信方式,统一了RESTful的标准,封装了http链接) ENUM_SMSAPI_URL:短信接口枚举类,用于存放短信接口API地址 #### Starter自动配置类 SmsProperties:该类主要用于读取yml/properties信息。之后就可以读取yml/properties配置文件,就像这样 ```yml # 配置测试项目的application.yml sms-config: account-sid: //这里填写平台获取的ID和KEY auth-token: //这里填写平台获取的ID和KEY appid: //这里填写平台获取的ID和KEY sms: enabled: true ``` SmsService:短信核心服务类,相当于在这对短信的参数进行封装,进行短信平台的请求 SmsAutoConfiguration:短信自动配置类,创建核心业务类。(PS:我觉得这个类就是用来) #### 在META-INF文件夹下新建spring.factories文件 ```xxx org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.sms.starter.config.SmsAutoConfiguration ``` #### 测试 之后就可以通过maven的install进行打包,测试。 如果打包出错,看看这篇文章,说不定有帮助。 https://blog.csdn.net/Camellia919/article/details/81190450 #### 环境 JDK:1.8 Spring-Boot:2.1.3 Fastjson:1.2.45