Comments (6)
This is the same as when you use spring's @Transactional
annotation, so how did you solve the same problem with your @Transactional
?
from incubator-seata.
This is the same as when you use spring's
@Transactional
annotation, so how did you solve the same problem with your@Transactional
?
After adding the @EnableAspectJAutoProxy(exposeProxy = true)
annotation, I can obtain the proxy object for @Transactional
through AopContext.currentProxy()
. By using the proxy object, @Transactional
becomes effective. However, this annotation does not work for @GlobalTransactional
, because the proxy object for @GlobalTransactional
is created by GlobalTransactionScanner
.
I temporarily constructed a GlobalTransactionScanner
myself, as shown below:
@Bean
@ConditionalOnMissingBean
@DependsOn({BEAN_NAME_SPRING_APPLICATION_CONTEXT_PROVIDER, BEAN_NAME_FAILURE_HANDLER})
public GlobalTransactionScanner globalTransactionScanner(SeataProperties seataProperties, FailureHandler failureHandler, ConfigurableListableBeanFactory beanFactory, @Autowired(required = false) List<ScannerChecker> scannerCheckers) {
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());
GlobalTransactionScanner globalTransactionScanner = new GlobalTransactionScanner(seataProperties.getApplicationId(), seataProperties.getTxServiceGroup(), failureHandler);
globalTransactionScanner.setExposeProxy(true);
return globalTransactionScanner;
}
Feel free to let me know if you need any further adjustments or additional details!
from incubator-seata.
Although this might be a question, it seems to stem from a lack of understanding about dynamic proxies. I don't think anyone would really use AopContext.currentProxy()
to call another annotated method within the same instance.
from incubator-seata.
Since you've identified this issue, I believe it's worth submitting a PR to resolve it.
from incubator-seata.
Since you've identified this issue, I believe it's worth submitting a PR to resolve it.
I believe the code changes required for this PR are minimal. We can add a new property private boolean exposeProxy = false;
below the useJdkProxy
property in the SeataProperties
class. Then, we can modify the creation of globalTransactionScanner
in the SeataAutoConfiguration
class accordingly.
Unfortunately, I'm not very familiar with the PR process. Could you please check if there are other contributors who could help with creating this PR?
Thank you!
from incubator-seata.
我一向认为发现问题的人如果有能力解决该问题的话,我会鼓励和指导他去完成一个pr的提交,这是参与社区的一种体现。
你可以先fork seata仓库,然后在你fork的仓库中基于2.x分支新建一个分支,然后将你fork仓库的分支拉到本地,进行代码改造开发,当完成后,你可提交到你的fork仓库的分支中,然后回到seata仓库,点击pull requests,再选择new pull requests,选择你的fork仓库的对应分支,提交到seata仓库的2.x分支中即可。
标题可以optimize: 开头
I've always believed that if the person who identifies a problem has the ability to solve it, I would encourage and guide them to submit a PR, which is a manifestation of participating in the community. You can first fork the seata repository, then create a new branch based on the 2.x branch in your forked repository, then pull the branch of your forked repository to local, and carry out code modification and development. When finished, you can commit to the branch of your forked repository, then go back to the seata repository, click on pull requests, then choose new pull requests, select the corresponding branch of your forked repository, and submit to the 2.x branch of the seata repository.
The title can start with "optimize: "
https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING.md
https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING_CN.md
from incubator-seata.
Related Issues (20)
- TCC mode two stage cannot be executed
- Source code depends on the git environment
- The module dependent on 'compatible' has not been correctly referenced.
- 源码少文件 HOT 1
- The distribute lock table is not config, please create the target table and config it HOT 6
- OceanBase数据库的mysql模式下创建的表,多主键,seata回滚失败,seata不支持多主键的表回滚吗? HOT 3
- 使用 2.0.0 版本并且使用root用户操作会无法启动的问题。 HOT 1
- v2.0.0版本,使用redis作为store时,无法连接redis HOT 1
- Why use @Async in ClusterWatcherManager
- k8s部署seata HOT 8
- 请问 2.1.0 什么时候发啊 等的花都要谢了 端午节前还有希望么 HOT 2
- seata 2.x是否支持数据库密码加密功能? HOT 2
- OceanBase数据库mysql模式,无法回滚
- 对于Oracle数据库中含有Timestamp字段的数据表无法进行二段校验 HOT 3
- druid连接池配置参数放开test-on-borrow HOT 2
- 0101 can not connect to 10.233.65.126:8091 cause:can not register RM,err:can not connect to services-server. HOT 2
- saga exception: java.lang.NullPointerException: Cannot invoke "io.seata.saga.engine.StateMachineEngine.forward(String, java.util.Map)" HOT 1
- mybatis调用Oracle存储过程开启事务报错 HOT 3
- 同一个服务中 两个被@TwoPhaseBusinessAction修饰的方法,方法A调用方法B,方法B对应的commitMethod,rollbackMethod未生效 HOT 1
- 手动回滚之后还会去触发commitTransaction方法? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incubator-seata.