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

二级域名怎么做网站备案wordpress 表单验证

二级域名怎么做网站备案,wordpress 表单验证,网站建设费钱吗,百度安装Springcloud OpenFeign 的实现(一) 一、Feign request/response 压缩 您可以考虑为您的外部请求启用请求或响应GZIP压缩。您可以通过启用以下属性之一来完成此操作: feign.compression.request.enabledtrue feign.compression.response.en…

Springcloud OpenFeign 的实现(一)

一、Feign request/response 压缩

您可以考虑为您的外部请求启用请求或响应GZIP压缩。您可以通过启用以下属性之一来完成此操作:

feign.compression.request.enabled=true
feign.compression.response.enabled=true

Feign 请求压缩给你的设置与你可能为你的Web服务器设置的类似:

spring.cloud.openfeign.compression.request.enabled=true
spring.cloud.openfeign.compression.request.mime-types=text/xml,application/xml,application/json
spring.cloud.openfeign.compression.request.min-request-size=2048

这些属性允许您选择压缩介质类型和最小请求阈值长度。
对于OkHttpClient之外的http客户端,可以启用默认gzip解码器以UTF-8编码解码gzip响应:

feign.compression.response.enabled=true
feign.compression.response.useGzipDecoder=true

二、Spring @MatrixVariable 的支持

Spring Cloud OpenFeign支持Spring@MatrixVariable注释。
如果将映射作为方法参数传递,则通过使用=连接映射中的键值对来创建@MatrixVariable路径段。
如果传递了不同的对象,则使用=将@MatrixVariable注释中提供的名称(如果已定义)或带注释的变量名称与提供的方法参数联接。

重要信息:
即使在服务器端,Spring也不要求用户将路径段占位符命名为与矩阵变量名称相同的名称,因为在客户端它将过于模糊,Spring Cloud OpenFeign要求您添加一个路径段占位符,其名称匹配@MatrixVariable注释(如果定义)中提供的名称或带注释的变量名称。
 

例如: 

@GetMapping("/objects/links/{matrixVars}")
Map<String, List<String>> getObjects(@MatrixVariable Map<String, List<String>> matrixVars);

请注意,变量名和路径段占位符都称为矩阵变量。

@FeignClient("demo")
public interface DemoTemplate {@GetMapping(path = "/stores")CollectionModel<Store> getStores();
}

三、Feign Spring Cloud CircuitBreaker 的支持

如果Spring Cloud CircuitBreaker位于类路径上,并且feign.CircuitBreaker.enabled=true,则feign将用断路器包装所有方法。
要在每个客户端的基础上禁用Spring Cloud CircuitBreaker支持,请创建一个香草外观。具有“原型”范围的建造商,例如:

@Configuration
public class FooConfiguration {@Bean@Scope("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 FallbackFactory<FallbackWithFactory> {@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.yayakq.cn/news/920037/

相关文章:

  • 佛山网站建设专家什么是网络推广员
  • 网站制作公司智能 乐云践新谭木记网页制作教程
  • 苏州北京商场网站建设asp.net网站管理工具
  • 建设学院网站的通知书阜南县建设局网站
  • 购物网站建设流程个人简历模板免费网站
  • 网站核验点查询wordpress微商城模板下载
  • 建设部房地产网站新网站建设脑图
  • 建工教育网校官方网站做网站公司东莞
  • 济南网站建设正规公司中学网站系统源码
  • 百度网站优化外包网页制作是什么专业学的
  • 长沙网站建设外包微商城官网登录
  • dw+如何做自适应网站win7 iis配置本地网站
  • 柳州 网站建设做网站80端口
  • 仪征建设局网站佛山当地网站建设公司
  • 书店网站建设策划书总结亚马逊电商平台怎么入驻
  • 挪车网站开发2012服务器如何做网站
  • ps插件国外网站python做网站开发
  • 研发地网站建设室内设计软件哪个比较好
  • 影院资讯 wordpress一流的镇江网站优化
  • 免费代理上网网站做外贸网站维护费是多少
  • 网站开发交流平台互站网
  • 标准网站建设推荐wordpress动漫图片主题
  • 公司主营网站开发怎么做账宁波网站建设价格
  • 各大门户网站有哪些网站服务器ip地址查询
  • 网站建设公司那记号千度网站
  • 乐清做网站公司哪家好网站推广托管
  • 婚庆网站的设计意义太原网站改版
  • 株洲网站设计外包运营饮料代理一年能挣80万
  • seo如何优化网站推广wordpress系统api接口
  • 医院预约挂号系统网站开发方案网站地址和网页地址