zoukankan      html  css  js  c++  java
  • 每周总结:2019年12月第5周

    2019-12-23

      1.SpringCloud Feign调用url带{ } 时怎么处理? 例如:Proxy包中的接口-----答案:不处理,该怎么调用就怎么调用

      

       2.SpringFrameWork好用的日志打点API,

      StopWatch

      

    2019-12-24

      1.使用RestTemplate远程调用,

        public static void main(String[] args) {
            String url = String.format("https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=%s",
                    "xxxxxx");
            Map headers=new HashMap<String,String> (16);
            headers.put("Content-Type", "application/json; charset=UTF-8");
    
            RestTemplate restTemplate = new RestTemplateBuilder().build();
            Map<String,Object> params=new HashMap<>(16);
            params.put(WxMsgConstant.TO_USER, "@all");
            params.put(WxMsgConstant.MSG_TYPE,"text");
            params.put(WxMsgConstant.AGENT_ID, 1000002);
            Map<String,String> contentMap =new HashMap<>(16);
            contentMap.put(WxMsgConstant.CONTENT, "消息推送,请及时查看");
            params.put(WxMsgConstant.TEXT, contentMap);
    
            ResponseEntity<WxMessageResp> entity = restTemplate.postForEntity(url, JSON.toJSONString(params), WxMessageResp.class);
    
            WxMessageResp body = entity.getBody();
            log.info(body.toString());
        }

    2019-12-25

      1.SpringCloud Feign远程调用的配置问题:

        由于Feign集成了Ribbon和Hystrix,因此主要也是主要也是配置这两个组件:

            1.配置Ribbon,用于获取服务列表,保证高可用

            2.配置Hystrix,用于保证整个Feign调用的过程中的超时熔断,

              并且配置时要保证该Hystrix的熔断时间要大于ribbon获取服务列表的时间,并且配置enable hystrix :true,

            3.注意:Feign 好像不支持GetMapping这样的组合注解,并且注解中需要显示的声明value值,否则会爆出illegalState异常

            4.Feign远程调用时,如果方法参数是实体,则需要提供默认的构造方法

            5.SpringCloud Feign 本质上是对RestTemplate的封装

         

    2019-12-31

      1.Xshell 复制粘贴的小技巧

            工具->选项->键盘和鼠标,配置中间按钮"粘贴剪切板的内容"

      

    2019-12-31

      1.查看Linux日志常用的指令

        例如:日志文件为 info.20191231.log

        -1. 实时查看尾部日志 tail -f  info.20191231.log / 查看尾部100行实时日志  tail -100f  info.20191231.log

        -2.查找日志中某个关键字符所有的行 cat -n   info.20191231.log | grep '关键字符'

        -3.定位到关键字符所在的行之后,查看该行前后多少行的日志

          例如定位到20000行之后,通常是查看前后10行的日志,因为命令为 sed -n '19990,20010p' info.20191231.log 

        

      

  • 相关阅读:
    Android 面试题汇总
    Android中Listview展示及其优化好处
    手机APP创建桌面快捷方式
    popupwindow展示
    showSetPwdDialog--自定义对话框
    android 四大组件之---Service
    会话技术( Cookie ,Session)
    Request 和 Response 原理
    Servlet的生命周期+实现方式
    pull解析器: 反序列化与序列化
  • 原文地址:https://www.cnblogs.com/july-sunny/p/12129943.html
Copyright © 2011-2022 走看看