【发布时间】:2017-11-19 02:48:09
【问题描述】:
当我问这个问题时,我没有找到任何满足我要求的解决方案。
要求:
目前我正在使用带有 Rest 和 Spring 集成的 Spring Boot 进行项目。
我的要求是将所有网关服务调用记录到审计表中,以了解两种情况的成功和失败。每个网关都包含必须存储在审计表中的网关特定信息。我正在使用 spring AOP - @After Advice 注释来记录审计信息,但是这个注释方法需要审计值,这些值是网关服务 CALLER 方法的一部分。
例子:
@Autowired
com.study.pattern.sample.app.gateway.EmployeGatewayservice employeGatewayservice;
public EmployeOutput getEmployeInformation(EmployeInput employeInput,AuditInput auditInput)
{
employeGatewayservice.getEmployeInfomation(employeInput);
}
如何在我的建议中获取 auditInput 对象。
@Pointcut("execution(* com.study.pattern.sample.app.gateway..*(..))")
protected void gateWayCalls()
{
}
@After("gateWayCalls()")
public void logAfter(JoinPoint joinPoint) {
**// Here i need auditInput Object**
}
我在调用 getEmployeInformation() 上的通知方法时受到限制 因为某些服务方法包含非网关调用逻辑。
就我而言,我必须在网关上使用 Aspect 而不是在服务方法上。
我正在寻找一种解决方案,如何将 Caller 方法参数放入我的 spring aop @After 建议中?
【问题讨论】:
标签: spring spring-integration aop aspectj spring-aop