我使用AOP概念,调度员将调用发送到before advice方法。在那里,如何在没有进入控制器的情况下在建议方法之前返回值?
public Object cache(JoinPoint jointPoint, RedisCache redisCache) throws Throwable{
String data = getRedisService().getValue(redisKey);
if(data != null){return "hi";}
}
答案 0 :(得分:0)
Before advice runs before a matched method execution
It has the opportunity to do work both before and after the method
executes, and to determine when, how, and even if, the method actually
gets to execute at all