SoFunction
Updated on 2025-03-08

Solve no return value after using AOP's @Around

After testing, the return value of the surrounding notification has changed. The facet method needs to have a return value to return the result instead of the proxy method.

Change it to the following:

@Around("point_update()")
public Object update(ProceedingJoinPoint jp) throws Throwable{
 ...
 Object result = ();
 ...
 return result;
}

Just let the result after execution return.

Supplement: spring aop @Around Return parameter value is empty

AOP is used in spring project. After intercepting the front-end request, the return parameter is empty after the @Around is processed in AOP.

By checking that the return type of the Controller method of the interface layer is void, there is no problem if the return value is changed to the same.

The above is personal experience. I hope you can give you a reference and I hope you can support me more. If there are any mistakes or no complete considerations, I would like to give you advice.