【发布时间】:2016-10-24 00:53:47
【问题描述】:
我想建议以下方法
public BaseRepresentationObject createLedgerTransaction(Long fromUserId, Long toUserId, Double serviceAmount,
Double masaryCommission, Double merchantCommission, Double appliedFees, Double tax, Long ratePlanId,
Long serviceId, String pendingTrx, String globalTrxId)
并提取两个参数:pendingTrx、globalTrxId 用于通知方法。
我使用下面的执行表达式:
@Around("execution(* com.masary.ledger.service.components.LedgerTransactionComponent.createLedgerTransaction(..)) && args(pendingTrx,globalTrxId,..)")
public Object doBasicProfilingLedgerCreate(final ProceedingJoinPoint pjp , String pendingTrx, String globalTrxId) throws Throwable
应用构建成功,但是advice代码没有执行。
我在我的配置类中使用带有@EnableAspectJAutoProxy(proxyTargetClass=true) 的Spring boot。
顺便说一句,我有 @AfterThrowing 建议正确运行。所以我高度认为问题出在我的执行表达式上。
更新: 我有一个很奇怪的发现:当我使用任何 String 类型的参数时,建议不起作用,否则(Long 或 Double)它会起作用。
有什么解释吗?
【问题讨论】:
标签: spring-boot aop aspectj spring-aop