You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by cherrylzhao <zh...@126.com> on 2018/09/17 04:21:17 UTC

[DISSCUSS]order annotation can't work in TransactionAspectConfig

Hi

I found that @order annotation can’t work in TransactionAspectConfig.java.
Now, we define the @order(0), @order(1) in Aspect beans, but when I adjust the value of order,
The aspect chains of dynamic proxy bean can’t change.

It seems that @order annotation can work with @Aspect annotation, so we need move the @order to the head of aspect bean like this:
-----
@Aspect
@Order(0)
public class SagaStartAspect {}

But this need omega-transaction module add spring dependency,it will increase the coupling of omega module.
Also we can remove the @order annotation from TransactionAspectConfig.java,  
so the default order is lowest and SagaStartAspect will be inside the @Transactional.


Best Wishes & Regards



Re: [DISSCUSS]order annotation can't work in TransactionAspectConfig

Posted by 赵俊 <zh...@jd.com>.
Hi, Willem

Now @Transactional Aspect is last one to the wrapper without the @order annotation.
I’ll send a PR to clean up @order later.

> On 17 Sep 2018, at 2:25 PM, Willem Jiang <wi...@gmail.com> wrote:
> 
> Hi Cherry,
> 
> Thanks for sharing this information with us.  Normally we just need
> make sure @Transactional Aspect is last one to the wrapper.
> Can you send a PR by clean up the order thing?
> 
> Willem Jiang
> 
> Twitter: willemjiang
> Weibo: 姜宁willem
> 
> On Mon, Sep 17, 2018 at 12:21 PM cherrylzhao <zh...@126.com> wrote:
>> 
>> Hi
>> 
>> I found that @order annotation can’t work in TransactionAspectConfig.java.
>> Now, we define the @order(0), @order(1) in Aspect beans, but when I adjust the value of order,
>> The aspect chains of dynamic proxy bean can’t change.
>> 
>> It seems that @order annotation can work with @Aspect annotation, so we need move the @order to the head of aspect bean like this:
>> -----
>> @Aspect
>> @Order(0)
>> public class SagaStartAspect {}
>> 
>> But this need omega-transaction module add spring dependency,it will increase the coupling of omega module.
>> Also we can remove the @order annotation from TransactionAspectConfig.java,
>> so the default order is lowest and SagaStartAspect will be inside the @Transactional.
>> 
>> 
>> Best Wishes & Regards
>> 
>> 


Re: [DISSCUSS]order annotation can't work in TransactionAspectConfig

Posted by Willem Jiang <wi...@gmail.com>.
Hi Cherry,

Thanks for sharing this information with us.  Normally we just need
make sure @Transactional Aspect is last one to the wrapper.
Can you send a PR by clean up the order thing?

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Mon, Sep 17, 2018 at 12:21 PM cherrylzhao <zh...@126.com> wrote:
>
> Hi
>
> I found that @order annotation can’t work in TransactionAspectConfig.java.
> Now, we define the @order(0), @order(1) in Aspect beans, but when I adjust the value of order,
> The aspect chains of dynamic proxy bean can’t change.
>
> It seems that @order annotation can work with @Aspect annotation, so we need move the @order to the head of aspect bean like this:
> -----
> @Aspect
> @Order(0)
> public class SagaStartAspect {}
>
> But this need omega-transaction module add spring dependency,it will increase the coupling of omega module.
> Also we can remove the @order annotation from TransactionAspectConfig.java,
> so the default order is lowest and SagaStartAspect will be inside the @Transactional.
>
>
> Best Wishes & Regards
>
>