继承MethodBeforeAdvice

CTBOK CTBOK 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我正在看书,里面的代码如下:

package com.java.chapter23;

import org.aspectj.apache.bcel.classfile.Method;
import org.springframework.aop.MethodBeforeAdvice;

public class BeforeAdvice1 implements MethodBeforeAdvice { <--出错行
public void before(Method method, Object[] args , Object target) throws Throwable {
System.out.println("before Advice:" + target.getClass().getName() + "." + method.getName() + " 参数值:" + args[0]);
if (method.getName().equals("getHello")) {
args[0] = "超人";
}
}
}

提示BeforeAdvice1那里出错,提示如下:
The type BeforeAdvice1 must implement the inherited abstract method
MethodBeforeAdvice.before(Method, Object[], Object)
请问为什么?谢谢
...全文
评论 6
收藏 已收藏
分享
返回顶部
CTBOK
Web 开发 81,107 成员 341,720 内容