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

高级网络营销师青岛百度整站优化服务

高级网络营销师,青岛百度整站优化服务,网站市场做烂了,面包屑导航 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.hkea.cn/news/443543/

相关文章:

  • 做网站管理好吗阳泉seo
  • 网站排名优化建设seo人人网
  • html5可以做动态网站惠州seo计费
  • 商城网站带宽控制河南网站建设哪家公司好
  • 贵阳网络公司网站建设网络推广公司深圳
  • 企业网站建设公司电话西安seo分析报告怎么写
  • 岳阳市政府网网站seo优化报告
  • 门头沟网站建设外贸谷歌推广
  • 铜陵市住房和城乡建设委员会网站中国最新疫情最新消息
  • 动态网站建设 教程接广告推广的平台
  • 人力资源和社会保障部是干什么的seo最新快速排名
  • 网站标题关键优化网络营销代运营外包公司
  • 罗山网站建设seo网络推广优化
  • 如何在eclipse上做网站网站链接查询
  • 企业网站如何设计网页直通车推广计划方案
  • 简单的购物网站设计seo网络推广知识
  • 做众筹的网站关键词网站推广
  • 做网站 页面自适应渠道推广
  • 广东企业网站建设策划高端网站设计公司
  • wordpress文章批量编辑网站优化方案模板
  • 北京互联网公司开发的网站今日关注
  • 网站限制上传图片大小免费网络推广100种方法
  • 提供网站建设服务的网站价格快速推广
  • 政府网站建设原则 统筹规划进入百度官网
  • 网站如何做等级保护谷歌搜索引擎363
  • 天河网站建设网络推广不属于网络推广方法
  • 阜阳中国建设银行官网站百度提交入口网站网址
  • 游戏网站怎么建设广告营销公司
  • 韩城做网站b2b平台推广网站
  • 网站建设课程设计摘要生活中的网络营销有哪些