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

wordpress建站入门手机 写wordpress

wordpress建站入门,手机 写wordpress,搜云seo,黄浦区seo网站建设Springcloud OpenFeign 的实现#xff08;一#xff09; 一、Feign request/response 压缩 您可以考虑为您的外部请求启用请求或响应GZIP压缩。您可以通过启用以下属性之一来完成此操作#xff1a; feign.compression.request.enabledtrue feign.compression.response.en…Springcloud OpenFeign 的实现一 一、Feign request/response 压缩 您可以考虑为您的外部请求启用请求或响应GZIP压缩。您可以通过启用以下属性之一来完成此操作 feign.compression.request.enabledtrue feign.compression.response.enabledtrue Feign 请求压缩给你的设置与你可能为你的Web服务器设置的类似 spring.cloud.openfeign.compression.request.enabledtrue spring.cloud.openfeign.compression.request.mime-typestext/xml,application/xml,application/json spring.cloud.openfeign.compression.request.min-request-size2048这些属性允许您选择压缩介质类型和最小请求阈值长度。 对于OkHttpClient之外的http客户端可以启用默认gzip解码器以UTF-8编码解码gzip响应 feign.compression.response.enabledtrue feign.compression.response.useGzipDecodertrue 二、Spring MatrixVariable 的支持 Spring Cloud OpenFeign支持SpringMatrixVariable注释。 如果将映射作为方法参数传递则通过使用连接映射中的键值对来创建MatrixVariable路径段。 如果传递了不同的对象则使用将MatrixVariable注释中提供的名称如果已定义或带注释的变量名称与提供的方法参数联接。 重要信息 即使在服务器端Spring也不要求用户将路径段占位符命名为与矩阵变量名称相同的名称因为在客户端它将过于模糊Spring Cloud OpenFeign要求您添加一个路径段占位符其名称匹配MatrixVariable注释如果定义中提供的名称或带注释的变量名称。   例如  GetMapping(/objects/links/{matrixVars}) MapString, ListString getObjects(MatrixVariable MapString, ListString matrixVars); 请注意变量名和路径段占位符都称为矩阵变量。 FeignClient(demo) public interface DemoTemplate {GetMapping(path /stores)CollectionModelStore getStores(); } 三、Feign Spring Cloud CircuitBreaker 的支持 如果Spring Cloud CircuitBreaker位于类路径上并且feign.CircuitBreaker.enabledtrue则feign将用断路器包装所有方法。 要在每个客户端的基础上禁用Spring Cloud CircuitBreaker支持请创建一个香草外观。具有“原型”范围的建造商例如 Configuration public class FooConfiguration {BeanScope(prototype)public Feign.Builder feignBuilder() {return Feign.builder();} } 断路器名称遵循这种模式feignClientName_calledMethod。当调用名为foo的FeignClient且调用的接口方法为bar时断路器名称将为foo_bar。 四、在配置文件中配置CircuitBreaker 你可以在application.yml中配置属性来配置 CircuitBreaker。 例如如果你有这个 Feign 客户端 FeignClient(url http://localhost:8080) public interface TestClient {GetMapping(Test)String getTest(); }你可以通过以下方式使用配置属性来配置它 spring:cloud:openfeign:circuitbreaker:enabled: truealphanumeric-ids:enabled: true resilience4j:circuitbreaker:instances:DemoClientgetDemo:minimumNumberOfCalls: 60timelimiter:instances:DemoClientgetDemo:timeoutDuration: 10s 五、Feign Spring Cloud CircuitBreaker Fallback Spring Cloud CircuitBreaker支持回退的概念当电路开路或出现错误时执行的默认代码路径。要为给定的FeignClient启用回退请将回退属性设置为实现回退的类名。您还需要将实现声明为SpringBean。 FeignClient(name test, url http://localhost:${server.port}/, fallback Fallback.class) protected interface TestClient {RequestMapping(method RequestMethod.GET, value /hello)Hello getHello();RequestMapping(method RequestMethod.GET, value /hellonotfound)String getException();}Component static class Fallback implements TestClient {Overridepublic Hello getHello() {throw new NoFallbackAvailableException(Boom!, new RuntimeException());}Overridepublic String getException() {return Fixed response;}} 如果需要访问导致回退触发器的原因可以在FeignClient中使用fallbackFactory属性。 FeignClient(name testClientWithFactory, url http://localhost:${server.port}/,fallbackFactory TestFallbackFactory.class) protected interface TestClientWithFactory {RequestMapping(method RequestMethod.GET, value /hello)Hello getHello();RequestMapping(method RequestMethod.GET, value /hellonotfound)String getException();}Component static class TestFallbackFactory implements FallbackFactoryFallbackWithFactory {Overridepublic FallbackWithFactory create(Throwable cause) {return new FallbackWithFactory();}}static class FallbackWithFactory implements TestClientWithFactory {Overridepublic Hello getHello() {throw new NoFallbackAvailableException(Boom!, new RuntimeException());}Overridepublic String getException() {return Fixed response;}}
http://www.dnsts.com.cn/news/8777.html

相关文章:

  • 如何建立公司网站模块wordpress自动备份
  • 婚纱网站源码信息网站推广
  • 网网站站建建设设wordpress营业中
  • 重庆seo网站管理企业顺德网站建设
  • 自己做网站还是开淘宝wordpress 緩慢
  • 微网站免费制作一个网址多少钱
  • 腾讯云阻止网站访问自建购物网站
  • 绘本馆网站建设没有充值入口的传奇游戏
  • 云南网站建设找天软枣庄手机网站制作
  • 演示网站怎么做扬州有什么做网站的公司
  • 益阳做网站怎么便宜陕西网上注册公司流程视频
  • 做网站哪些比较好无极分期网站
  • 那些行业需要做网站网站备案 新增接入
  • php 开发手机网站携程电子商务网站建设
  • wordpress建站 app访问东营建网站公司
  • 网站建设作业教程电脑网站建设策划书
  • 网站在线演示建立平台还是搭建平台
  • 中机建设一公司网站app开发大概费用多少钱合适
  • 建立网站信息内容建设管理规范做公益网站又什么要求
  • 四个免费h5网站网上购物商城官网入口
  • 如何做网站模版天津市建设厅注册中心网站
  • 网站优化师负责干什么济南网站建设丨 首选搜点网络
  • 文山建设局网站学生个人网页制作素材
  • 洛阳霞光建设网站cpanel 安装wordpress
  • 网站推广常用方法包括小程序外包
  • seo网站优化快速排名软件wordpress4.4.1下载
  • 在线a视频网站一级a做爰片网页界面设计使用的单位主要是
  • 江苏赛孚建设工程有限公司网站怎么样建设个人网站
  • 秦皇岛电子网站建设保险网站有哪些保险网站
  • 做影视网站侵权吗怎么给我 的网站做关键词