2

I came across a spring-aop-transaction.xml file in my project. There are two sections.

<aop:config>
    <aop:advisor
        pointcut="execution

Here all the interfaces are declared. And

<tx:advice id="TxAdvice" transaction-manager="transactionManager">
        <tx:attributes>

Here all the method names are specified. I was wondering if the sequence in which the method names are mentioned make a difference or they have to be in exact same sequence as the declaration of the interfaces.

Thanks for the answers.

EDIT: How do I force close an open transaction.

EX:

<tx:method name="updateData" propagation="REQUIRES_NEW"
    rollback-for="Exception"/>

This transaction is continued to be used by another method creating problems. Thanks in advance.

Tushar Banne
  • 1,587
  • 4
  • 20
  • 38

1 Answers1

2

You can mark order precedence for your aspects, means effectively your advises run in order http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html#aop-ataspectj-advice-ordering

@Order(2)

So when multiple point cuts matching a target, the advice get executed based on there order of precedence, means @Order(1) marked aspect(advice) get executed before @Order(2)

You can check an example done here Ordering aspects with Spring AOP && MVC

Community
  • 1
  • 1
kuhajeyan
  • 10,727
  • 10
  • 46
  • 71