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

单页网站怎么做seo免费网站流量

单页网站怎么做seo,免费网站流量,微信自己怎么创建公众号,个人网站能不能做论坛目录地址: SpringCloudAlibaba整合-CSDN博客 这里只关注代码部分,至于sentinel服务UI的实用,后面可以补上 这里做一个改造: 因为sentinel可以和openfeign结合使用,为微服务做熔断降级; 为了方便微服务之间…

目录地址:

SpringCloudAlibaba整合-CSDN博客

这里只关注代码部分,至于sentinel服务UI的实用,后面可以补上

这里做一个改造:

因为sentinel可以和openfeign结合使用,为微服务做熔断降级;

为了方便微服务之间的调用,把远程调用接口移动到api模块;

所以把order中的openfeign和loadbalancer依赖,放到api的pom中,并且把order中Remote接口,移动到api中;后续order只需要引入api的依赖,调用api中的接口即可

1.在api中引入sentinel和openfeign

<!--openfeign-->
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency><!--loadbalancer-->
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency><!--sentinel-->
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>

2.把接口从order转移到api,并修改

@FeignClient(name="my-user", fallbackFactory = UserServiceFactory.class)
public interface RemoteUserService {@RequestMapping("/user/listAll")public List<User> listAll();@GetMapping("/user/getById")public User getById(@RequestParam("id") Integer id);
}

api模块,添加UserServiceFactory类

@Component
public class UserServiceFactory implements FallbackFactory<RemoteUserService> {@Overridepublic RemoteUserService create(Throwable cause) {return new RemoteUserService() {@Overridepublic List<User> listAll() {return null;}@Overridepublic User getById(Integer id) {System.out.println("user服务异常");return null;}};}
}

3.注意要把UserServiceFactory放到META-INF/spring.factories文件中

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.test.api.remote.fallbackFactory.UserServiceFactory,\
com.test.api.remote.fallbackFactory.ProductServiceFactory

4.order引入api依赖,并在启动类添加注解,扫描feignClient接口

@EnableFeignClients(basePackages = {"com.test.api.remote"})

5.order的配置文件添加

feign:sentinel:enabled: true

6.重启服务,访问接口,正常访问

此时停止user服务,再次访问order接口,返回null,后台日志打印“user服务异常”

http://www.dinnco.com/news/59408.html

相关文章:

  • 微信网站建设和维护报价表网站建设是什么工作
  • 个人网站代码html打开百度一下
  • 许昌做网站汉狮网络搜索引擎优化包括
  • 有没有做长图的网站关键词优化 搜索引擎
  • 做网站一年赚多少钱seo优化教程自学
  • 网站建站哪个公司好一点网站开发公司排行榜
  • 哪个网站的前台背景墙做的好网页设计学生作业模板
  • 京东物流网站建设特点seo案例分析及解析
  • 做视频网站收费标准石家庄
  • 网站怎么做百度认证百度快照的作用是什么
  • wordpress商城建站找培训机构的平台
  • 物流如何做网站广州优化防控措施
  • 专业点网站制作公司短视频推广app
  • 能建网站的appseo技巧
  • 太原seo网站排名怎样在百度上做免费推广
  • 深圳宝安网站建设工网络营销推广活动有哪些
  • wordpress主题空白seo技术大师
  • 宁波企业网站设计西安seo代理计费
  • 网站建设柒金手指下拉二一seo技巧课程
  • 如何建论坛网站中国关键词网站
  • 西樵网站建设设计网站的公司
  • 刷业务网站怎么做游戏代理加盟平台
  • 橙子建站app百度seo在线优化
  • 山西科技网站建设商丘关键词优化推广
  • 济南商城网站制作百度搜索收录
  • 徐州玉龙湾旅游开发公司深圳网站seo哪家快
  • 网站怎么做360免费优化卖网站链接
  • 如何进行电子商务网站推广?网络营销模式
  • 陕西住房和城乡建设委员会网站黄冈网站推广策略
  • 靠谱的做网站的公司线上营销的优势