spring - @Transactional AspectJ Advice -
i added custom @around advice bean's method. bean transactional. how can create advice run within transaction?
i utilize aspectj add together advices.
advice code:
class="lang-java prettyprint-override">@aspect @order(200) public class myadvice { @around public object wrap(final proceedingjoinpoint pjp) throws throwable { object ret = pjp.proceed(); // processing requires transaction homecoming ret; } }
bean code:
class="lang-java prettyprint-override">public class mybean { // method wrapped myadvice.wrap @transactional public object somebusinessmethod() { // ... } }
spring configuration:
class="lang-xml prettyprint-override"><tx:annotation-driven transaction-manager="transactionmanager" order="100" mode="proxy" /> <aop:aspectj-autoproxy />
i need myadvice.wrap
run within same transaction mybean.somebusinessmethod
.
spring aspectj
No comments:
Post a Comment