当前位置: 首页 > news >正文

长武网站建设软件开发专业用什么笔记本

长武网站建设,软件开发专业用什么笔记本,网站ftp怎么登陆,开公司的流程参考文章 作用 用注解的方式动态切换实现类实现方式。 比如我们有多个消息中间件或多个短信服务商&#xff0c;需要动态切换的时候&#xff0c;无需自己写判断逻辑来进行服务商的切换。只用一套注解就可以解决问题 开始使用 引入依赖 <dependency><groupId>io…

参考文章

作用

用注解的方式动态切换实现类实现方式。
比如我们有多个消息中间件或多个短信服务商,需要动态切换的时候,无需自己写判断逻辑来进行服务商的切换。只用一套注解就可以解决问题

开始使用

引入依赖

<dependency><groupId>io.github.burukeyou</groupId><artifactId>spring-smart-di-all</artifactId><version>0.2.0</version>
</dependency>
下载不下来需要拿到jar包打入本地仓库
mvn install:install-file -Dfile=D://spring-smart-di-all-0.2.0.jar -DgroupId=io.github.burukeyou -DartifactId=spring-smart-di-all -Dversion=0.2.0 -Dpackaging=jar

jar包在我的下载里面有上传

开启注解使用

package com.dino;import com.burukeyou.smartdi.annotations.EnableSmartDI;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;@Slf4j
@EnableSmartDI
@SpringBootApplication
public class DinoOaApp {public static void main(String[] args) {log.info("====== Business Starting... ======");ConfigurableApplicationContext ctx = null;try {ctx = new SpringApplicationBuilder(DinoOaApp.class).web(WebApplicationType.SERVLET).run(args);log.info("====== Business Started! ======");} catch (Exception e) {if (ctx != null) {log.error("Business application start failed and exit: {}", e.getMessage(), e);System.exit(SpringApplication.exit(ctx));}}}
}

实现类实现

定义实现类
package com.dino.business.sms;import com.burukeyou.smartdi.proxyspi.spi.EnvironmentProxySPI;
import com.dino.utils.sms.SmsSendRequest;@EnvironmentProxySPI("${sms.impl}")
public interface SmsService {Boolean sendSms(String mobile);
}
实现实现类
package com.dino.business.sms.impl;import com.burukeyou.smartdi.annotations.BeanAliasName;
import com.dino.business.sms.SmsService;
import com.dino.utils.sms.SmsSendRequest;
import com.dino.utils.sms.SmsUtils;
import org.springframework.stereotype.Component;import javax.annotation.Resource;/*** 阿里短信发送*/
@BeanAliasName("ali")
@Component
public class AliSmsServiceImpl implements SmsService {@Resourceprivate SmsUtils smsUtils;@Overridepublic Boolean sendSms(String mobile) {return smsUtils.sendAliSMS(mobile);}
}
package com.dino.business.sms.impl;import com.burukeyou.smartdi.annotations.BeanAliasName;
import com.dino.business.sms.SmsService;
import com.dino.utils.sms.SmsSendRequest;
import com.dino.utils.sms.SmsUtils;
import org.springframework.stereotype.Component;import javax.annotation.Resource;/*** 创蓝短信发送*/
@BeanAliasName("cl")
@Component
public class ClSmsServiceImpl implements SmsService {@Resourceprivate SmsUtils smsUtils;@Overridepublic Boolean sendSms(String mobile) {return smsUtils.sendClSms(mobile);}
}

配置文件配置

# 短信类型  阿里:ali  创蓝 cl
sms:impl: cl
接口调用@AutowiredProxySPIprivate SmsService smsService;public Boolean sendSmsCode(String mobile) {     return smsService.sendSms(mobile);}
http://www.yayakq.cn/news/630715/

相关文章:

  • 做视频投稿赚钱的网站好最近新闻
  • wordpress旅游网站湖北省建设厅招骋网站
  • 学校网站建设介绍范文英文字体展示网站推荐
  • 物流网站源代码导航网站怎么赚钱
  • wordpress 多媒体尺寸上饶网站seo
  • 电子商务网站建设htmlwordpress数据库名字
  • 学校网站手机站的建设方案网站百度地图标记代码
  • 河南省住房和建设厅网站现在进出重庆最新规定
  • 电脑宽带网站提供企业网站建设方案
  • 依波手表价格 官方网站家庭nas可以做网站服务器
  • 公司建设网站属于什么费用wordpress文件缓存
  • 网站建设及推广方案网站该怎么做
  • 网站开发实训周志专门做中式服装平台的网站
  • 网站做的和别人一样违法二维码自动生成
  • 自己做网站需要固定ip吗浙江特种作业证件查询
  • 深圳语种网站建设佛山 建站公司
  • 网站建设模板怎么设计建设一个网站要钱吗
  • 做网站后端需要学什么网站空间数据库
  • ps软件下载免费东莞百度seo排名
  • 做网站小程序的客户是怎么找的千海网站建设 小程序
  • 漯河做网站公司优秀的ui设计案例分析
  • 网站开发的安全性主要考虑哪些wordpress时间代码
  • 网站页面报价网站制作后还能更改么
  • 自己电脑做网站空间上海工程网站建设
  • 温州网站建设费用aso优化软件
  • 扶余市建设局网站网页qq属于什么
  • 企业网站翻译网站建设系统优势
  • 做网站前的准备什么软件万网企业邮箱登陆界面如何嵌入到自己的网站
  • 有哪些网站是中国风网站高唐企业建网站服务商
  • 网站建设属于那个科目网络口碑营销的特点