j8typz 发表于 2024-8-4 13:04:10

同事写了一个责任链模式,bug无数!


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">点击上方“</span><span style="color: black;">芋道源码</span><span style="color: black;">”,<span style="color: black;">选取</span>“<a style="color: black;">设为星标</a>”</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">管她前浪,还是后浪?</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">能浪的浪,才是好浪!</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">每日</span> </span><span style="color: black;"><strong style="color: blue;">10:33</strong></span><span style="color: black;">&nbsp;更新<span style="color: black;">文案</span>,<span style="color: black;">每日</span>掉亿点点头发...</span></p><span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">源码精品专栏</p>
    </span>&nbsp;<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">原创 | Java 2021&nbsp;超神之路,很肝~</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">中文<span style="color: black;">仔细</span>注释的开源项目</a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">RPC 框架 Dubbo 源码解析</a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">网络应用框架 Netty 源码解析</a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">信息</span>中间件 RocketMQ</a> 源码解析</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">数据库中间件 Sharding-JDBC 和 MyCAT 源码解析</a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">作业调度中间件 Elastic-Job 源码解析</a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">分布式事务中间件 TCC-Transaction 源码解析</a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">Eureka 和 Hystrix 源码解析</a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">Java 并发源码</a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;"><span style="color: black;">源自</span>:网络</span></a></p><a style="color: black;">什么是责任链</a><a style="color: black;">场景</a><a style="color: black;">反例</a><a style="color: black;">初步改造</a><a style="color: black;">缺点</a><a style="color: black;">责任链改造</a><a style="color: black;">责任链</a>工厂改造<a style="color: black;">聊聊其他</a>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">近期</span>,我让团队内一位成员写了一个导入功能。他<span style="color: black;">运用</span>了责任链模式,代码堆的非常多,bug <span style="color: black;">亦</span>多,<span style="color: black;">无</span>达到我预期的效果。<span style="color: black;">实质</span>上,针对导入功能,我认为模版<span style="color: black;">办法</span>更合适!为此,隔壁团队<span style="color: black;">亦</span>拿出<span style="color: black;">咱们</span>的案例,进行了集体 code review。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">学好设计模式,且不要为了练习,强行<span style="color: black;">运用</span>!让<span style="color: black;">本来</span>100行就能实现的功能,写了 3000 行!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">对错暂且不论,<span style="color: black;">咱们</span>先<span style="color: black;">一块</span><span style="color: black;">瞧瞧</span>责任链设计模式吧!</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;"><a style="color: black;">什么是责任链</a></span></h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">「责任链模式」</strong> 是一种<span style="color: black;">行径</span>设计模式, <span style="color: black;">准许</span>你将请求沿着处理者链进行发送。收到请求后, <span style="color: black;">每一个</span>处理者均可对请求进行处理, 或将其传递给链上的下个处理者。</p><a style="color: black;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/JdLkEI9sZffA8Gu0uJuGKsmTXCXWo2iajXOialUYf1GQUGauCTibVek1DkauGUKvuAouDpd4WUZFuVuDMa6JPVbEQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></a>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">基于 Spring Boot + MyBatis Plus + Vue &amp; Element 实现的后台管理系统 + 用户小程序,支持 RBAC 动态权限、多租户、数据权限、工作流、三方登录、支付、短信、商城等功能。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">项目<span style="color: black;">位置</span>:https://github.com/YunaiV/ruoyi-vue-pro</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;"><a style="color: black;">场景</a></span></h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">责任链的<span style="color: black;">运用</span>场景还是比较多的</p>多<span style="color: black;">要求</span>流程判断:权限<span style="color: black;">掌控</span>ERP 系统流程审批:总经理、人事经理、项目经理Java 过滤器 的底层实现 Filter<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>不<span style="color: black;">运用</span>该设计模式,<span style="color: black;">那样</span>当需求有所改变时,就会使得代码臃肿<span style="color: black;">或</span>难以<span style="color: black;">守护</span>,例如下面的例子</p>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;"><a style="color: black;">反例</a></h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">假设<span style="color: black;">此刻</span>有一个闯关游戏,进入下一关的<span style="color: black;">要求</span>是上一关的分数要高于xx</p>游戏一共 3 个关卡进入第二关<span style="color: black;">必须</span><span style="color: black;">第1</span>关的游戏得分大于等于 80进入第三关<span style="color: black;">必须</span>第二关的游戏得分大于等于 90<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">那样</span>代码<span style="color: black;">能够</span><span style="color: black;">这般</span>写</p><span style="color: black;">//<span style="color: black;">第1</span>关</span><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">FirstPassHandler</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"<span style="color: black;">第1</span>关--&gt;FirstPassHandler"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">80</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">//第二关</span><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">SecondPassHandler</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"第二关--&gt;SecondPassHandler"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">90</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">//第三关</span><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">ThirdPassHandler</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"第三关--&gt;ThirdPassHandler,这是最后一关啦"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">95</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">//客户端</span><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">HandlerClient</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">static</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">main</span><span style="color: black;">(String[]&nbsp;args)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>FirstPassHandler&nbsp;firstPassHandler&nbsp;=<span style="color: black;">new</span>&nbsp;FirstPassHandler();<span style="color: black;">//<span style="color: black;">第1</span>关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SecondPassHandler&nbsp;secondPassHandler&nbsp;=&nbsp;<span style="color: black;">new</span>&nbsp;SecondPassHandler();<span style="color: black;">//第二关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThirdPassHandler&nbsp;thirdPassHandler&nbsp;=&nbsp;<span style="color: black;">new</span>ThirdPassHandler();<span style="color: black;">//第三关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">int</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;firstScore&nbsp;=&nbsp;firstPassHandler.handler();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//<span style="color: black;">第1</span>关的分数大于等于80则进入第二关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(firstScore&nbsp;&gt;=&nbsp;<span style="color: black;">80</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">int</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">secondScore&nbsp;=&nbsp;secondPassHandler.handler();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//第二关的分数大于等于90则进入第二关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(secondScore&nbsp;&gt;=&nbsp;<span style="color: black;">90</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;thirdPassHandler.handler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">那样</span><span style="color: black;">倘若</span>这个游戏有100关,<span style="color: black;">咱们</span>的代码很可能就会写成这个样子</p><span style="color: black;">if</span>(第<span style="color: black;">1</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关<span style="color: black;">经过</span>){</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;第2关&nbsp;游戏</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(第<span style="color: black;">2</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关<span style="color: black;">经过</span>){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;第3关&nbsp;游戏</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(第<span style="color: black;">3</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关<span style="color: black;">经过</span>){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;第4关&nbsp;游戏</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(第<span style="color: black;">4</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关<span style="color: black;">经过</span>){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;第5关&nbsp;游戏</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(第<span style="color: black;">5</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关<span style="color: black;">经过</span>){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;第6关&nbsp;游戏</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(第<span style="color: black;">6</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关<span style="color: black;">经过</span>){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//...</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这种代码不仅冗余,并且当<span style="color: black;">咱们</span>要将某两关进行<span style="color: black;">调节</span>时会对代码非常大的改动,这种操作的<span style="color: black;">危害</span>是很高的,<span style="color: black;">因此呢</span>,该写法非常糟糕</p>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;"><a style="color: black;">初步改造</a></h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">怎样</span><span style="color: black;">处理</span>这个问题,<span style="color: black;">咱们</span><span style="color: black;">能够</span><span style="color: black;">经过</span>链表将每一关连接起来,形成责任链的方式,<span style="color: black;">第1</span>关<span style="color: black;">经过</span>后是第二关,第二关<span style="color: black;">经过</span>后是第三关 ....,<span style="color: black;">这般</span>客户端就不<span style="color: black;">必须</span>进行多重 if 的判断了</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">FirstPassHandler</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/**</p>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style="color: black;">第1</span>关的下一关是&nbsp;第二关</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
    </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">SecondPassHandler&nbsp;secondPassHandler;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">setSecondPassHandler</span><span style="color: black;">(SecondPassHandler&nbsp;secondPassHandler)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.secondPassHandler&nbsp;=&nbsp;secondPassHandler;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//本关卡游戏得分</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">private</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">play</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">80</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"<span style="color: black;">第1</span>关--&gt;FirstPassHandler"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(play()&nbsp;&gt;=&nbsp;<span style="color: black;">80</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//分数&gt;=80&nbsp;并且存在下一关才进入下一关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(<span style="color: black;">this</span>.secondPassHandler&nbsp;!=&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.secondPassHandler.handler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">80</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">SecondPassHandler</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/**</p>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;第二关的下一关是&nbsp;第三关</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
    </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;ThirdPassHandler&nbsp;thirdPassHandler;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">setThirdPassHandler</span><span style="color: black;">(ThirdPassHandler&nbsp;thirdPassHandler)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.thirdPassHandler&nbsp;=&nbsp;thirdPassHandler;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//本关卡游戏得分</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">private</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">play</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">90</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>System.out.println(<span style="color: black;">"第二关--&gt;SecondPassHandler"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(play()&nbsp;&gt;=&nbsp;<span style="color: black;">90</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//分数&gt;=90&nbsp;并且存在下一关才进入下一关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(<span style="color: black;">this</span>.thirdPassHandler&nbsp;!=&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.thirdPassHandler.handler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">90</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">ThirdPassHandler</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//本关卡游戏得分</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">private</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">play</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">95</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/**</p>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;这是最后一关,<span style="color: black;">因此呢</span><span style="color: black;">无</span>下一关</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
    </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"第三关--&gt;ThirdPassHandler,这是最后一关啦"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;play();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">HandlerClient</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">static</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">main</span><span style="color: black;">(String[]&nbsp;args)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FirstPassHandler&nbsp;firstPassHandler&nbsp;=&nbsp;<span style="color: black;">new</span>&nbsp;FirstPassHandler();<span style="color: black;">//第一关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SecondPassHandler&nbsp;secondPassHandler&nbsp;=&nbsp;<span style="color: black;">new</span>&nbsp;SecondPassHandler();<span style="color: black;">//第二关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThirdPassHandler&nbsp;thirdPassHandler&nbsp;=&nbsp;<span style="color: black;">new</span>&nbsp;ThirdPassHandler();<span style="color: black;">//第三关</span>firstPassHandler.setSecondPassHandler(secondPassHandler);<span style="color: black;">//<span style="color: black;">第1</span>关的下一关是第二关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;secondPassHandler.setThirdPassHandler(thirdPassHandler);<span style="color: black;">//第二关的下一关是第三关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//说明:<span style="color: black;">由于</span>第三关是最后一关,<span style="color: black;">因此呢</span><span style="color: black;">无</span>下一关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//<span style="color: black;">起始</span>调用<span style="color: black;">第1</span>关&nbsp;每一个关卡<span style="color: black;">是不是</span>进入下一关卡&nbsp;在<span style="color: black;">每一个</span>关卡中判断</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;firstPassHandler.handler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;"><a style="color: black;">缺点</a></h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">现有模式的缺点</p><span style="color: black;">每一个</span>关卡中都有下一关的成员变量并且是不<span style="color: black;">同样</span>的,形成链很不方便代码的扩展性非常<span style="color: black;">欠好</span>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;"><a style="color: black;">责任链改造</a></h3>既然<span style="color: black;">每一个</span>关卡中都有下一关的成员变量并且是不<span style="color: black;">同样</span>的,<span style="color: black;">那样</span><span style="color: black;">咱们</span><span style="color: black;">能够</span>在关卡上抽象出一个父类<span style="color: black;">或</span>接口,<span style="color: black;">而后</span><span style="color: black;">每一个</span><span style="color: black;">详细</span>的关卡去继承<span style="color: black;">或</span>实现<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">有了思路,<span style="color: black;">咱们</span>先来简单介绍一下责任链设计模式的<strong style="color: blue;">「基本<span style="color: black;">构成</span>」</strong></p>抽象处理者(Handler)角色:定义一个处理请求的接口,<span style="color: black;">包括</span>抽象处理<span style="color: black;">办法</span>和一个后继连接。<span style="color: black;">详细</span>处理者(Concrete Handler)角色:实现抽象处理者的处理<span style="color: black;">办法</span>,判断能否处理<span style="color: black;">这次</span>请求,<span style="color: black;">倘若</span><span style="color: black;">能够</span>处理请求则处理,否则将该请求转给它的后继者。客户类(Client)角色:创建处理链,并向链头的<span style="color: black;">详细</span>处理者对象提交请求,它不关心处理细节和请求的传递过程。<a style="color: black;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/JdLkEI9sZffA8Gu0uJuGKsmTXCXWo2iajP03r8Q6IAej09bWHnLF5gG8MTd0iajbfTPkDBxkAPviaYqSCicic7cQxCA/640?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></a>责任链改造<span style="color: black;">public</span>&nbsp;<span style="color: black;">abstract</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">AbstractHandler</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/**</p>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;下一关用当前抽象类来接收</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
    </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">protected</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">AbstractHandler&nbsp;next;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">setNext</span><span style="color: black;">(AbstractHandler&nbsp;next)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.next&nbsp;=&nbsp;next;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">abstract</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">FirstPassHandler</span>&nbsp;<span style="color: black;">extends</span>&nbsp;<span style="color: black;">AbstractHandler</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">private</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">play</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">80</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">@Override</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"<span style="color: black;">第1</span>关--&gt;FirstPassHandler"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">int</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;score&nbsp;=&nbsp;play();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(score&nbsp;&gt;=&nbsp;<span style="color: black;">80</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//分数&gt;=80&nbsp;并且存在下一关才进入下一关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(<span style="color: black;">this</span>.next&nbsp;!=&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.next.handler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;score;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">SecondPassHandler</span>&nbsp;<span style="color: black;">extends</span>&nbsp;<span style="color: black;">AbstractHandler</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">private</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">play</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">90</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"第二关--&gt;SecondPassHandler"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">int</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;score&nbsp;=&nbsp;play();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(score&nbsp;&gt;=&nbsp;<span style="color: black;">90</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//分数&gt;=90&nbsp;并且存在下一关才进入下一关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(<span style="color: black;">this</span>.next&nbsp;!=&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.next.handler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;score;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">ThirdPassHandler</span>&nbsp;<span style="color: black;">extends</span>&nbsp;<span style="color: black;">AbstractHandler</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">private</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">play</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">95</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">int</span>&nbsp;<span style="color: black;">handler</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"第三关--&gt;ThirdPassHandler"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">int</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;score&nbsp;=&nbsp;play();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(score&nbsp;&gt;=&nbsp;<span style="color: black;">95</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//分数&gt;=95&nbsp;并且存在下一关才进入下一关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>(<span style="color: black;">this</span>.next&nbsp;!=&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">){</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.next.handler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;score;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">HandlerClient</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">static</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">main</span><span style="color: black;">(String[]&nbsp;args)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FirstPassHandler&nbsp;firstPassHandler&nbsp;=&nbsp;<span style="color: black;">new</span>&nbsp;FirstPassHandler();<span style="color: black;">//<span style="color: black;">第1</span>关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SecondPassHandler&nbsp;secondPassHandler&nbsp;=&nbsp;<span style="color: black;">new</span>SecondPassHandler();<span style="color: black;">//第二关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThirdPassHandler&nbsp;thirdPassHandler&nbsp;=&nbsp;<span style="color: black;">new</span>&nbsp;ThirdPassHandler();<span style="color: black;">//第三关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;和上面<span style="color: black;">无</span>更改的客户端代码相比,<span style="color: black;">仅有</span><span style="color: black;">这儿</span>的set<span style="color: black;">办法</span><span style="color: black;">出现</span>变化,其他都是<span style="color: black;">同样</span>的</span>firstPassHandler.setNext(secondPassHandler);<span style="color: black;">//<span style="color: black;">第1</span>关的下一关是第二关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;secondPassHandler.setNext(thirdPassHandler);<span style="color: black;">//第二关的下一关是第三关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//说明:<span style="color: black;">由于</span>第三关是最后一关,<span style="color: black;">因此呢</span><span style="color: black;">无</span>下一关</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//从<span style="color: black;">第1</span>个关卡<span style="color: black;">起始</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">firstPassHandler.handler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;"><a style="color: black;">责任链工厂改造</a></h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">针对</span>上面的请求链,<span style="color: black;">咱们</span><span style="color: black;">亦</span><span style="color: black;">能够</span>把这个关系<span style="color: black;">守护</span>到配置文件中<span style="color: black;">或</span>一个枚举中。我将<span style="color: black;">运用</span>枚举来教会<span style="color: black;">大众</span>怎么动态的配置请求链并且将<span style="color: black;">每一个</span>请求者形成一条调用链。</p><span style="color: black;">public</span>&nbsp;<span style="color: black;">enum</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;GatewayEnum&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;handlerId,&nbsp;拦截者名<span style="color: black;">叫作</span>,全限定类名,preHandlerId,nextHandlerId</span>&nbsp;&nbsp;&nbsp;&nbsp;API_HANDLER(<span style="color: black;">new</span>&nbsp;GatewayEntity(<span style="color: black;">1</span>,&nbsp;<span style="color: black;">"api接口限流"</span>,&nbsp;<span style="color: black;">"cn.dgut.design.chain_of_responsibility.GateWay.impl.ApiLimitGatewayHandler"</span>,&nbsp;<span style="color: black;">null</span>,&nbsp;<span style="color: black;">2</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">)),</p>BLACKLIST_HANDLER(<span style="color: black;">new</span>&nbsp;GatewayEntity(<span style="color: black;">2</span>,&nbsp;<span style="color: black;">"黑名单拦截"</span>,&nbsp;<span style="color: black;">"cn.dgut.design.chain_of_responsibility.GateWay.impl.BlacklistGatewayHandler"</span>,&nbsp;<span style="color: black;">1</span>,&nbsp;<span style="color: black;">3</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">)),</p>&nbsp;&nbsp;&nbsp;&nbsp;SESSION_HANDLER(<span style="color: black;">new</span>&nbsp;GatewayEntity(<span style="color: black;">3</span>,&nbsp;<span style="color: black;">"用户会话拦截"</span>,&nbsp;<span style="color: black;">"cn.dgut.design.chain_of_responsibility.GateWay.impl.SessionGatewayHandler"</span>,&nbsp;<span style="color: black;">2</span>,&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">)),</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;GatewayEntity&nbsp;gatewayEntity;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;GatewayEntity&nbsp;<span style="color: black;">getGatewayEntity</span><span style="color: black;">()</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;gatewayEntity;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;GatewayEnum(GatewayEntity&nbsp;gatewayEntity)&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">this</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.gatewayEntity&nbsp;=&nbsp;gatewayEntity;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">GatewayEntity</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">String&nbsp;name;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;String&nbsp;conference;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;Integer&nbsp;handlerId;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;Integer&nbsp;preHandlerId;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;Integer&nbsp;nextHandlerId;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">interface</span>&nbsp;<span style="color: black;">GatewayDao</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/**</p>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">*&nbsp;<span style="color: black;">按照</span>&nbsp;handlerId&nbsp;获取配置项</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style="color: black;">@param</span>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;handlerId</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style="color: black;">@return</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
    </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">GatewayEntity&nbsp;<span style="color: black;">getGatewayEntity</span><span style="color: black;">(Integer&nbsp;handlerId)</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/**</p>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;获取<span style="color: black;">第1</span>个处理者</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style="color: black;">@return</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
    </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">GatewayEntity&nbsp;<span style="color: black;">getFirstGatewayEntity</span><span style="color: black;">()</span></span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">GatewayImpl</span>&nbsp;<span style="color: black;">implements</span>&nbsp;<span style="color: black;">GatewayDao</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/**</p>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;初始化,将枚举中配置的handler初始化到map中,方便获取</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
    </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>&nbsp;<span style="color: black;">static</span>&nbsp;Map&lt;Integer,&nbsp;GatewayEntity&gt;&nbsp;gatewayEntityMap&nbsp;=&nbsp;<span style="color: black;">new</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">HashMap&lt;&gt;();</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">static</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GatewayEnum[]&nbsp;values&nbsp;=&nbsp;GatewayEnum.values();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">for</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;(GatewayEnum&nbsp;value&nbsp;:&nbsp;values)&nbsp;{</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GatewayEntity&nbsp;gatewayEntity&nbsp;=&nbsp;value.getGatewayEntity();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">gatewayEntityMap.put(gatewayEntity.getHandlerId(),&nbsp;gatewayEntity);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">@Override</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;GatewayEntity&nbsp;<span style="color: black;">getGatewayEntity</span><span style="color: black;">(Integer&nbsp;handlerId)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">gatewayEntityMap.get(handlerId);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">@Override</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;GatewayEntity&nbsp;<span style="color: black;">getFirstGatewayEntity</span><span style="color: black;">()</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">for</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;(Map.Entry&nbsp;entry&nbsp;:&nbsp;gatewayEntityMap.entrySet())&nbsp;{
    </p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">GatewayEntity&nbsp;value&nbsp;=&nbsp;entry.getValue();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;&nbsp;<span style="color: black;">无</span>上一个handler的<span style="color: black;">便是</span><span style="color: black;">第1</span>个</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>&nbsp;(value.getPreHandlerId()&nbsp;==&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">)&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;value;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">GatewayHandlerEnumFactory</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>&nbsp;<span style="color: black;">static</span>GatewayDao&nbsp;gatewayDao&nbsp;=<span style="color: black;">new</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;GatewayImpl();</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;<span style="color: black;">供给</span>静态<span style="color: black;">办法</span>,获取<span style="color: black;">第1</span>个handler</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">static</span>&nbsp;GatewayHandler&nbsp;<span style="color: black;">getFirstGatewayHandler</span><span style="color: black;">()</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">GatewayEntity&nbsp;firstGatewayEntity&nbsp;=&nbsp;gatewayDao.getFirstGatewayEntity();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GatewayHandler&nbsp;firstGatewayHandler&nbsp;=&nbsp;newGatewayHandler(firstGatewayEntity);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">if</span>&nbsp;(firstGatewayHandler&nbsp;==&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">)&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">GatewayEntity&nbsp;tempGatewayEntity&nbsp;=&nbsp;firstGatewayEntity;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Integer&nbsp;nextHandlerId&nbsp;=&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GatewayHandler&nbsp;tempGatewayHandler&nbsp;=&nbsp;firstGatewayHandler;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;迭代遍历所有handler,以及将它们链接起来</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">while</span>&nbsp;((nextHandlerId&nbsp;=&nbsp;tempGatewayEntity.getNextHandlerId())&nbsp;!=&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">)&nbsp;{</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GatewayEntity&nbsp;gatewayEntity&nbsp;=&nbsp;gatewayDao.getGatewayEntity(nextHandlerId);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">GatewayHandler&nbsp;gatewayHandler&nbsp;=&nbsp;newGatewayHandler(gatewayEntity);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tempGatewayHandler.setNext(gatewayHandler);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tempGatewayHandler&nbsp;=&nbsp;gatewayHandler;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">tempGatewayEntity&nbsp;=&nbsp;gatewayEntity;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;<span style="color: black;">//&nbsp;返回<span style="color: black;">第1</span>个handler</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;firstGatewayHandler;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/**</p>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;反射实体化<span style="color: black;">详细</span>的处理者</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style="color: black;">@param</span>
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;firstGatewayEntity</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style="color: black;">@return</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
    </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">private</span>&nbsp;<span style="color: black;">static</span>&nbsp;GatewayHandler&nbsp;<span style="color: black;">newGatewayHandler</span><span style="color: black;">(GatewayEntity&nbsp;firstGatewayEntity)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;获取全限定类名</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;className&nbsp;=&nbsp;firstGatewayEntity.getConference();&nbsp;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">try</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">//&nbsp;<span style="color: black;">按照</span>全限定类名,加载并初始化该类,即会初始化该类的静态段</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">Class&nbsp;clazz&nbsp;=&nbsp;Class.forName(className);
    </p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;(GatewayHandler)&nbsp;clazz.newInstance();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: black;">catch</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">(ClassNotFoundException&nbsp;|&nbsp;IllegalAccessException&nbsp;|&nbsp;InstantiationException&nbsp;e)&nbsp;{</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">return</span>&nbsp;<span style="color: black;">null</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">GetewayClient</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">static</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">main</span><span style="color: black;">(String[]&nbsp;args)</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">GetewayHandler&nbsp;firstGetewayHandler&nbsp;=&nbsp;GetewayHandlerEnumFactory.getFirstGetewayHandler();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;firstGetewayHandler.service();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">基于微服务的思想,构建在 B2C 电商场景下的项目实战。核心技术栈,是 Spring Boot + Dubbo 。<span style="color: black;">将来</span>,会重<span style="color: black;">形成</span> Spring Cloud Alibaba 。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">项目<span style="color: black;">位置</span>:https://github.com/YunaiV/onemall</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;"><a style="color: black;">聊聊其他</a></span></h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">设计模式有<span style="color: black;">非常多</span>,责任链只是其中的一种,我觉得<span style="color: black;">特别有</span>意思,非常值得一学。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">设计模式确实是一门艺术,仍需<span style="color: black;">奋斗</span>呀!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">欢迎加入我的知识星球,<span style="color: black;">一块</span>探讨架构,交流源码。加入方式,<strong style="color: blue;"><span style="color: black;">长按下方二维码噢</span></strong>
    </p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">:</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">已在知识星球更新源码解析如下:</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">近期</span>更新《芋道 SpringBoot 2.X 入门》系列</span><span style="color: black;">,<span style="color: black;">已然</span> 101 余篇,覆盖了&nbsp;</span><span style="color: black;">MyBatis、Redis、MongoDB、ES、分库分表、读写分离、SpringMVC、Webflux、权限、WebSocket、Dubbo、RabbitMQ、RocketMQ、Kafka、性能测试等等内容。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">供给</span>近 3W 行<span style="color: black;">代码</span>的 SpringBoot 示例,以及超 4W 行代码的电商微服务项目。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">获取方式:点“</span><span style="color: black;"><strong style="color: blue;">在看</strong></span><span style="color: black;">”,关注公众号并回复&nbsp;</span><span style="color: black;"><strong style="color: blue;">666</strong></span><span style="color: black;">&nbsp;领取,<span style="color: black;">更加多</span>内容<span style="color: black;">持续</span>奉上。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">文案</span>有<span style="color: black;">帮忙</span>的话,在看,转发吧。</strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">谢谢支持哟 (*^__^*)</strong></span></p>




zrd123 发表于 2024-9-25 07:20:14

软文发布平台 http://www.fok120.com/

nykek5i 发表于 2024-11-7 01:26:43

i免费外链发布平台 http://www.fok120.com/

4lqedz 发表于 7 天前

你的努力一定会被看见,相信自己,加油。
页: [1]
查看完整版本: 同事写了一个责任链模式,bug无数!