-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: fix the failure of @BusinessActionContextParamete annotation … #6475
base: 2.x
Are you sure you want to change the base?
bugfix: fix the failure of @BusinessActionContextParamete annotation … #6475
Conversation
…to set parameters into io.seata.rm.tcc.api.BusinessActionContext. A interface instead of its implementation class should be passed to io.seata.integration.tx.api.interceptor.ActionInterceptorHandler#fetchActionRequestContext to get parameters noted by "@BusinessActionContextParameter". apache#6473
d12ce4f
to
89d2967
Compare
spring/src/test/java/org/apache/seata/spring/tcc/TccActionInterceptorHandlerTest.java
Show resolved
Hide resolved
…rceptorHandlerTest.java
May I know what is going on? How can I merge my pull request to the target branch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you tell me what shall I do further to merge pull request successfully?
According to the community CONTRIBUTING.md, you may not merge PR directly. After someone who has write permission reviews and approves, and then it can be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you shed some lights on why changing targetBean
to invocation.getTarget()
can sort it out? The latter can be subclass of the former, is that what you are tring to solve?
As shown in the figure you provided, both |
That makes sense for me. What do you think @funky-eyes? |
I agree with you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@ptyin It is really a bugfix. I do the optimization by the way. There several bugs here: |
The third point, are you trying to express that when using @BusinessActionContextParameter in the interface and @TwoPhaseBusinessAction in the implementation class, it leads to the invalidation of @BusinessActionContextParameter? |
What I did in the bugfix is to get the exact method annotated by @TwoPhaseBusinessAction and @BusinessActionContextParameter. (I suppose that it is a convention to put them together on a TCC try method of interface, at least putting them together) @ptyin @funky-eyes |
我们未来希望注解都是在实现类中,而不是在接口上,目前的实现中我们之前就发现了子类会覆盖父类,导致最终的参数读取行为不准。由于tcc的特殊性,他的接口可能是由provider提供,如果注解都写在接口上时,会导致consumer与provider都进行了方法切面等行为,这是不可取的,经过社区的会议,未来会不允许注解在接口上,而是需要再实现类上 In the future, we prefer annotations to be placed in implementation classes rather than interfaces. In our current implementation, we have encountered issues where subclasses override parent classes, leading to inaccurate parameter reading behavior. Due to the unique nature of TCC, its interfaces may be provided by the provider. If annotations are placed on interfaces, it will result in both the consumer and the provider performing method interception, which is undesirable. Following discussions within the community, annotations will not be allowed on interfaces in the future, and instead, they will need to be placed on implementation classes. |
Make sense! |
I will run some tests on this PR, and if the tests pass, I will merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@funky-eyes Please help me review it again! Thanks a lot! |
我的例子就是上面所说的,当TwoPhaseBusinessAction在实现类中,而BusinessActionContextParameter在接口中时,会读取不到BusinessActionContextParameter相关的参数,我认为6454中描述的是我这种情况,所以无法正确读取到参数。 |
@funky-eyes As far as I know, The author of issue 6454 has just put the two annotations together on the TCC try method, just as the picture shown below. |
#6235 |
I feel you. It is really a best practice to put the two annotations on the TCC try method of the implementation class. |
@funky-eyes I don't know what's going about this PR. What else do I need to do to merge this PR? Could you tell me? |
I plan to consider merging this PR in version 2.2, and I would like it to change the annotation method to a complementary form with priority setting, rather than solely using annotations from the parent class or the subclass. |
Ⅰ. Describe what this PR did
fix the failure of @BusinessActionContextParamete annotation to set parameters into io.seata.rm.tcc.api.BusinessActionContext at TCC mode
Ⅱ. Does this pull request fix one issue?
fixes #6454
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews