为了账号安全,请及时绑定邮箱和手机立即绑定

报java.lang.ClassCastException: springAOP.ServiceGongNeng cannot be cast to springAOP.ServiceInterfaceFunction,求解答

目录结构:

https://img1.sycdn.imooc.com//5ce7ad550001ecfa03640210.jpg

接口及其实现类代码:

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("切面前置通知功能实现了");

}

}

配置文件:
https://img1.sycdn.imooc.com//5ce7ae2d00019ad514230857.jpg

正在回答

2 回答

修改为com.imooc.aop.schema.advice.*Biz  因为types-matching是到的类 不能到方法

1 回复 有任何疑惑可以回复我~

新手回答,是不是有一个文件没有保存

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Spring入门篇
  • 参与学习       268762    人
  • 解答问题       963    个

为您带来IOC和AOP的基本概念及用法,为后续高级课程学习打下基础

进入课程

报java.lang.ClassCastException: springAOP.ServiceGongNeng cannot be cast to springAOP.ServiceInterfaceFunction,求解答

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信