在实现Spring AOP的时候,程序出现
后来在网上查询了以后发现是:
这里的User 应该写成实现的接口,如下:
Person是User的接口。
可是为什么必须得这样写呢···
Exception in thread "main" org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'user' must be of type [com.sb.bean.User], but was actually of type [$Proxy6]
后来在网上查询了以后发现是:
User user=ac.getBean("user",User.class);
user.say();
这里的User 应该写成实现的接口,如下:
Person user= ac.getBean("user",User.class);
user.say();
Person是User的接口。
可是为什么必须得这样写呢···