报java.lang.ClassCastException: springAOP.ServiceGongNeng cannot be cast to springAOP.ServiceInterfaceFunction,求解答
目录结构:
接口及其实现类代码:
public interface ServiceInterfaceFunction {
public void print();
}
public class ServiceFunction implements ServiceInterfaceFunction {
@Override
public void print() {
System.out.println("逻辑功能接口实现类的方法执行了");
}
}
逻辑方法代码:
public class ServiceGongNeng {
public void say(){
System.out.println("哈哈哈哈哈哈哈");
}
}
切面类的代码:
public class AspectFunction {
public void beforeAspect(String name,int time){
System.out.println("名字为"+name);
System.out.println(time+"次");
System.out.println("切面前置通知功能实现了");
}
}
配置文件: