是否可以通过在spring aop中调用通知而不是方法来返回对象

时间:2013-01-22 16:30:11

标签: java spring-aop

我有这样的调用

SomeType type = factory.create(parameters);

有时我需要通过AOP将其替换为其他调用。

是否可以实现可以调用的建议而不是此方法并返回 SomeType

类似的东西:

public SomeType returnFakeType(ProceedingJoinPoint jp) {
     Object[] args =jp.getArgs();
     Parameters params = (Parameters) args[0];
     SomeType type = new SomeType();
     type.setParameters(params);

     return type;
}

换句话说,我需要在不更改代码的情况下替换获取SomeType类型。通过AOP。

0 个答案:

没有答案