springaop的切面 @Aspect 不其效果的问题请教

问题描述:

我有一个抽象类:AbstractApi,里面有一个抽象方法

public abstract String handle(RequestParam requestParam, ResponseParam responseParam)

然后所有的具体业务Api(比如支付PayApi,订单OrderApi,)都是继承AbstractApi,然后实现handle方法,

我现在是要在所有的实现AbstractApi类的handle方法都做一个切面,但是不其效果,请大神指教:

 


@Aspect
@Component
public class ApiCallLockAspect extends AbstractAspect {

    protected final Logger LOG = LoggerFactory.getLogger(getClass());

    @Around("execution(* com.app.exdata.api..*.*Api.handle(com.app.RequestParam,com.app.ResponseParam))")
    public Object aroundAdvice(ProceedingJoinPoint point) throws Exception {


    }

 

 

不起效果的话,哪里都可能出问题,你要多给点信息,你这写法我光就这样粗看没看出啥毛病(你首先要确认切点表达式写对了)

是否启用了注解 这是一种启用的方式

@Configuration
@ComponentScan("edu.nf.ch15")
/**
 * 启用AspectJ注解处理器,等同于xml中的<aop:aspectj-autoproxy/>
 */
@EnableAspectJAutoProxy
public class SpringConfig {
}

@Around("execution(* com.app.exdata.api..*.*Api.handle(com.app.RequestParam,com.app.ResponseParam))") 改成

@Around("execution(* com.app.exdata.api..*.*Api.handle(..))") 试一下