springboot 整合seata , 15.1 版本如何手动设置数据源代理? 看官网上面说“若外部实现初始化,请参考SeataAutoConfiguration保证依赖加载顺序”,但是按照这个来并没有成功是什么原因呢? 代码如下:
@Slf4j @Slf4j @ConditionalOnProperty( prefix = "seata", name = {"enabled"}, havingValue = "true", matchIfMissing = true ) @AutoConfigureAfter({SeataCoreAutoConfiguration.class}) public class SeataProxyConfig {
@Bean({"failureHandler"})
@ConditionalOnMissingBean({FailureHandler.class})
public FailureHandler failureHandler() {
return new DefaultFailureHandlerImpl();
}
@Bean
@DependsOn({"springApplicationContextProvider", "failureHandler"})
@ConditionalOnMissingBean({GlobalTransactionScanner.class})
public GlobalTransactionScanner globalTransactionScanner(SeataProperties seataProperties, FailureHandler failureHandler,
ConfigurableListableBeanFactory beanFactory,
@Autowired(required = false) List<ScannerChecker> scannerCheckers) {
log.info("Automatically configure Seata");
GlobalTransactionScanner.setBeanFactory(beanFactory);
GlobalTransactionScanner.addScannerCheckers(EnhancedServiceLoader.loadAll(ScannerChecker.class));
GlobalTransactionScanner.addScannerCheckers(scannerCheckers);
GlobalTransactionScanner.addScannablePackages(seataProperties.getScanPackages());
GlobalTransactionScanner.addScannerExcludeBeanNames(seataProperties.getExcludesForScanning());
GlobalTransactionScanner.setAccessKey(seataProperties.getAccessKey());
GlobalTransactionScanner.setSecretKey(seataProperties.getSecretKey());
return new GlobalTransactionScanner(seataProperties.getApplicationId(), seataProperties.getTxServiceGroup(), failureHandler);
}
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。