<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      seata學(xué)習(xí)-數(shù)據(jù)源代理

      代理的動(dòng)機(jī)

      AT 模式下

      • 執(zhí)行 undo-log 回滾日志

      代理的是 DateSource 這個(gè)類

      手動(dòng)代理

      即手動(dòng)注入一個(gè)DataSourceProxy,如下

      @Bean
      public DataSource druidDataSource() {
          return new DruidDataSource()
      }
      
      
      // 這里會(huì)返回名字為 "dataSource" 的 Bean, 這里
      @Primary
      @Bean("dataSource")
      public DataSourceProxy dataSource(DataSource druidDataSource) {
          return new DataSourceProxy(druidDataSource);
      }
      

      即使在生成這個(gè)類的時(shí)候,手動(dòng)返回一個(gè) proxy

      自動(dòng)代理

      針對(duì)DataSource創(chuàng)建一個(gè)代理類,在代理類里面基于DataSource獲取DataSourceProxy(如果沒有就創(chuàng)建),然后調(diào)用DataSourceProxy的相關(guān)方法。核心邏輯在SeataAutoDataSourceProxyCreator

      public class SeataAutoDataSourceProxyCreator extends AbstractAutoProxyCreator {
          ... 
      }
      

      其中 AbstractAutoProxyCreator 來(lái)自 spring-aop

      其他 : 自動(dòng)代理是如何調(diào)用的呢 ?

      本人的項(xiàng)目是 spring cloud 的依賴如下

              <!-- 阿里相關(guān)依賴 -->
              <dependency>
                  <groupId>io.seata</groupId>
                  <artifactId>seata-spring-boot-starter</artifactId>
              </dependency>
              <dependency>
                  <groupId>com.alibaba.cloud</groupId>
                  <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
                  <exclusions>
                      <exclusion>
                          <groupId>io.seata</groupId>
                          <artifactId>seata-spring-boot-starter</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>
      

      這里使用的 seata 版本是 1.7 , 之前用 1.6 以及 1.4 有很多 bug , 從官網(wǎng)可以看到 1.7作為一個(gè)大版本更新 ,更新了很多bug提升了性能.

      回到上面的問題 : 自動(dòng)代理是如何調(diào)用的呢 ?
      即是 SeataAutoDataSourceProxyCreator 是如何給調(diào)用的呢 ? 在 seata-spring-boot-starter 這里依賴?yán)锩嬗幸粋€(gè) SeataDataSourceAutoConfiguration , 該類將會(huì)引入 SeataAutoDataSourceProxyCreator 完成代理 .

      @ConditionalOnBean({DataSource.class})
      @ConditionalOnExpression("${seata.enabled:true} && ${seata.enableAutoDataSourceProxy:true} && ${seata.enable-auto-data-source-proxy:true}")
      @AutoConfigureOrder(2147483647)
      @AutoConfigureAfter(
          value = {SeataCoreAutoConfiguration.class},
          name = {"org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration"}
      )
      public class SeataDataSourceAutoConfiguration {
          public SeataDataSourceAutoConfiguration() {
          }
      
      
          // 這里注入的
          @Bean({"seataAutoDataSourceProxyCreator"})
          @ConditionalOnMissingBean({SeataAutoDataSourceProxyCreator.class})
          public static SeataAutoDataSourceProxyCreator seataAutoDataSourceProxyCreator(SeataProperties seataProperties) {
              return new SeataAutoDataSourceProxyCreator(seataProperties.isUseJdkProxy(), seataProperties.getExcludesForAutoProxying(), seataProperties.getDataSourceProxyMode());
          }
      }
      

      參考資料

      posted @ 2023-08-17 17:05  float123  閱讀(287)  評(píng)論(0)    收藏  舉報(bào)
      主站蜘蛛池模板: 麻豆一区二区三区蜜桃免费| 激情97综合亚洲色婷婷五| 国产精品国产高清国产av| 无码精品国产va在线观看| 久久99精品久久久久久9| 国产高清视频一区二区乱| 国产97人人超碰caoprom| 亚洲国产综合一区二区精品| 国内视频偷拍一区,二区,三区| A级毛片100部免费看| 精品无码成人片一区二区| 夜夜爽日日澡人人添| 国产极品美女高潮抽搐免费网站| 久热中文字幕在线| 国产欧美亚洲精品第一页在线| 国产中文字幕在线一区| 清远市| 成av免费大片黄在线观看| 99热成人精品热久久66| 国产精品男女爽免费视频| 国产成人一区二区三区免费| 桐柏县| 久久青青草原亚洲AV无码麻豆| 久久97人人超人人超碰超国产 | 日日噜噜夜夜狠狠视频| 国产精品推荐手机在线| 人妻一区二区三区三区| 香蕉亚洲欧洲在线一区| a级国产乱理伦片在线观看al | 国产真实乱人偷精品人妻| 欧美成人精品手机在线| 国产精品十八禁一区二区| 大地资源中文第二页日本| 新丰县| 人妻丰满熟妇av无码区| 久久精品国产热久久精品国产亚洲 | 人妻精品久久无码区| 亚洲中文字幕第一页在线| 又湿又紧又大又爽A视频男| 亚洲国产精品成人综合久| 久热综合在线亚洲精品|