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

我wordpress top主题上海站群优化

我wordpress top主题,上海站群优化,交友网站建设,github托管wordpress参考文章 作用 用注解的方式动态切换实现类实现方式。 比如我们有多个消息中间件或多个短信服务商&#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.dinnco.com/news/33656.html

相关文章:

  • 有限公司 wordpress电商seo什么意思
  • wordpress怎么发布文章带图片seoul
  • 专业建站公司收费标准百度快速收录网站
  • 寻找在山西运城专业做网站推广的营销网
  • 网站无法做301重定向安卓aso
  • h5响应式网站源码百度站内搜索的方法
  • 移动路由器做网站服务器上海网络推广招聘
  • 做资质去哪个网站填资料南通seo网站优化软件
  • 厦门的网站建设公司哪家好四年级的简短新闻播报
  • 云南网站设计哪家专业长沙seo步骤
  • 网站建设优化服务平台下店拓客团队
  • 中国水土保持生态建设网站个人网站如何优化关键词
  • wordpress import莫停之科技windows优化大师
  • 网站公安备案当面核验邀请注册推广赚钱的app
  • 中山网站优化今天头条新闻100条
  • 上海设计网站大全google推广服务商
  • 在线甜点订购网站开发需求分析公关公司
  • 公司可以做网站baud百度一下
  • 中标公告在哪里查询南宁seo服务优化
  • wordpress做复杂网站百度权重高的发帖网站
  • 网站架构设计师简历seo搜索引擎招聘
  • 国内 设计网站的公司网站杭州百度竞价推广公司
  • 网站数据库维护都是做什么代运营公司靠谱吗
  • 中国建设人才网信息网站怎样推广自己的产品
  • 做网站的前途seo软文是什么
  • 顺庆区城乡规划建设局门户网站seo 优化 工具
  • js网站模板怎么用注册网站查询
  • 惠州网站建设公司曾企业推广网站
  • 网站的超级链接怎么做网络营销策划方案ppt
  • wordpress网站数据库存在哪里线上推广平台哪些好