Spring Cloud
Spring Cloud
whatzhang007
就不想写。。
展开
-
zuul网关RSA签名,AES加密
请求request处理代码只支持get,post链接https://blog.csdn.net/whatzhang007/article/details/122451527@Slf4j@Componentpublic class RequestParamsFilter extends ZuulFilter { public static final String T_KEY = "t"; public static final String S_KEY = "s"; @V原创 2022-01-12 13:54:26 · 517 阅读 · 1 评论 -
zuul的超时配置探究
路由分类serviceId路由,指的是ribbon负载均衡路由routes: commandKey: path: /uri serviceId: service-id主要核心逻辑在RibbonRoutingFilter类里,如下这里的RibbonCommandFactory实现类有好几种,默认为HttpClientRibbonCommandFactory一路下跟最后核心,也就是设置超时时间的核心逻辑url路由,不经过ribbonroutes:原创 2021-12-06 10:27:38 · 3581 阅读 · 1 评论 -
HystrixTimeout设置小记
源码如下,看完包会protected static HystrixCommandProperties.Setter createSetter(IClientConfig config, String commandKey, ZuulProperties zuulProperties) { //获取HystrixTimeout,设置HystrixCommand的Setter int hystrixTimeout = getHystrixTimeout(config, commandKey); r原创 2021-11-11 11:30:47 · 405 阅读 · 0 评论 -
Zuul中gzip处理
//兼容请求mock接口结果返回gzip数据,但是request请求头没有添加Accept-Encoding:gzip,deflate,brprivate void gzipBugfix(CloseableHttpResponse zuulResponse) throws IOException { Header firstHeader = zuulResponse.getFirstHeader(ZuulHeaders.CONTENT_ENCODING); if (Objects.nonN原创 2021-08-25 17:01:46 · 622 阅读 · 0 评论 -
Hystrix指标说明
原创 2021-08-25 14:47:48 · 124 阅读 · 0 评论 -
Zuul本地转发(访问Controller)
文档:https://jbone.cn/translate/spring-cloud-netflix-zuul/strangulation-patterns-and-local-forwards.htmlhttp://docs.springcloud.cn/user-guide/zuul/#_1核心代码org.springframework.cloud.netflix.zuul.filters.route.SendForwardFilter类原创 2021-07-05 14:07:41 · 560 阅读 · 0 评论 -
@PathVariable映射重复
1. 错误信息ava.lang.IllegalStateException: Ambiguous handler methods mapped for '/ervice/1111': {public void com.chinadaas.platform.dsp.servicemanage.controller.DownloadController.aa(java.lang.String), public void com.chinadaas.platform.dsp.servicemanage.cont原创 2020-12-23 18:26:15 · 284 阅读 · 2 评论 -
@PathVariable工作原理及URI解析参数
SpringMVC参数解析绑定的原理 https://zhuanlan.zhihu.com/p/33780880SpringMVC初始化时,RequestMappingHandlerAdapter类会把一些默认的参数解析器添加到argumentResolvers中。当SpringMVC接收到请求后首先根据url查找对应的HandlerMethod。遍历HandlerMethod的MethodParameter数组根据MethodParameter的类型来查找确认使用哪个HandlerMethodA原创 2020-12-23 15:09:03 · 1809 阅读 · 0 评论 -
SpringMVC图解
图一图二步骤:用户发送请求至前端控制器DispatcherServlet。DispatcherServlet收到请求调用HandlerMapping处理器映射器。处理器映射器找到具体的处理器(可以根据xml配置、注解进行查找),生成处理器对象及处理器拦截器(如果有则生成)一并返回给DispatcherServlet。DispatcherServlet调用HandlerAdapter处理器适配器。HandlerAdapter经过适配调用具体的处理器(Controller,也叫后端控制器)。转载 2020-12-15 15:19:44 · 177 阅读 · 0 评论 -
SpringMVC、 springBoot、zuul跨域问题解决
跨域问题SpringMVC跨域问题方法一:加入跨域处理配置@Configurationpublic class WebConfig implements WebMvcConfigurer { @Bean public CorsFilter corsFilter() { final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final CorsCon原创 2020-11-09 17:41:53 · 320 阅读 · 0 评论 -
zuul动态路由及uri匹配逻辑重写
动态路由自定义DynamicRouteLocator类继承SimpleRouteLocator,实现RefreshableRouteLocator接口RefreshRouteService.refreshRoute()刷新路由URI匹配重写getZuulRoute()就行核心代码 ZuulRoute route = getZuulRoute(adjustedPath);核心类图zuul的路由规则处理核心类SimpleRouteLocatorDynamicRouteLocator 代码原创 2021-02-01 17:11:31 · 758 阅读 · 0 评论