Bean named ‘xxxxxx‘ is expected to be of type ‘x‘ but was actually of type ‘com.sun.proxy.$Proxy112‘
Bean named 'instanceService' is expected to be of type 'awb.operations.service.instance.InstanceService' but was actually of type 'com.sun.proxy.$Proxy112'
类似Bean named 'xxxxxxx' is expected to be of type 'x' but was actually of type 'com.xx'这种异常,说明类型不对。
我仔细对比发现原来是我编写注入的是实现类,并不是接口导致的:
注入实现类
// 注入实现类错误!
@Autowired
private ServiceImpl serviceImpl;
// 应该注入接口类
@Autowired
private ServiceInterface serviceInterface;
解决方案:注入接口类。
分析:造成这个原因是粗心copy到了实现类,所以无法注入,应注入接口类。
Bean named ‘xxxxxx‘ is expected to be of type ‘x‘ but was actually of type ‘com.sun.proxy.$Proxy112‘的更多相关文章
- Spring错误之org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'bookService' is expected to be of type 'pw.fengya.tx.BookService' but was actually of type 'com.sun.proxy.$Proxy1
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cas ...
- Bean named 'XXX' is expected to be of type [XXX] but was actually of type [com.sun.proxy.$Proxy7
AOP原理 <aop:aspectj-autoproxy />声明自动为spring容器中那些配置@aspectJ切面的bean创建代理,织入切面. <aop:aspectj-aut ...
- Bean named '...' is expected to be of type [...] but was actually of type [com.sun.proxy.$Proxy7解决方法
报错 三月 07, 2017 8:09:52 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepare ...
- Springboot2.x 启动报错:Bean named 'xxxService'... but was actually of type 'com.sun.proxy.$Proxy82'
Springboot 2.0.5 搭建一个新项目启动后报错:Bean named 'xxxService'... but was actually of type 'com.sun.proxy.$Pr ...
- Spring:No bean named 'beanScope' is defined
初学Spring,“No bean named 'beanScope' is defined”这个问题困扰了我好几个小时,查资料无果后,重写好几遍代码后发现问题居然是配置文件不能放在包里...要放在s ...
- 解决BeanNotOfRequiredTypeException: Bean named 'XXX' must be of type XXX, but was actually of type XXX问题
Java新手,困扰了一下午. 发布时总是报这样一个错误. org.springframework.beans.factory.BeanCreationException: Error creating ...
- No bean named 'transactionManager' is defined
2016-10-20 23:27:17.771 INFO 7096 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped &quo ...
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSessionRepositoryFilter' is defined
spring-session 集成redis,web.xml配置filter时候出现 No bean named 'springSessionRepositoryFilter' is defined ...
- java 不寻常的问题 No bean named 'sessionFactory' is defined 和 initialize a collection of role
左右java的"No bean named 'sessionFactory' is defined " 现在经常出去SHH或在其框架内Sping+JPA使用底部HIbernate ...
- No bean named 'sessionFactory' is defined
1.错误叙述性说明 严重:Servlet service() for servlet default threw exception . org.springframework.beans.facto ...
随机推荐
- C++的extern关键字在HotSpot VM中的重要应用
extern关键字有两个用处: (1)extern在C/C++语言中表示函数和全局变量作用范围(可见性)的关键字,这个关键字会告诉编译器,其声明的函数和变量可以在本模块或其它模块中使用. (2)在C+ ...
- CSP初赛错题集
初赛错题集 洛谷有题 NOIP 2018 T9 给定一个含N 个不相同数字的数组,在最坏情况下,找出其中最大或最小的数,至少需要N - 1 次比较操作.则最坏情况下,在该数组中同时找最大与最小的数至少 ...
- CSS之3D翻转效果
<!DOCTYPE html> <html> <head> <title></title> <style type="tex ...
- pta乙级1033(C语言)散列表解法
#include"stdio.h" #include"string.h" int main() { int flag=1; char w[100010],ch[ ...
- 题解 CF1264D1
前言 数学符号约定: \(\dbinom{n}{m}\):表示 \(n\) 选 \(m\) . 如非特殊说明,将会按照上述约定书写符号. 题目分析: 考虑题目的问题弱一点的版本,假设此时我们的括号序列 ...
- Newbie_calculations
拿到这道题是个应用程序,经过上次的经验就跟程序交互了一下,结果根本交互不了,输入什么东西都没有反应 然后打开ida分析发现有几个函数还有一堆的操作数,看到这一堆东西就没心思分析了,后面才知道原来就是要 ...
- React同构与极致的性能优化
.markdown-body { line-height: 1.75; font-weight: 400; font-size: 16px; overflow-x: hidden; color: rg ...
- 一篇文章带你了解Python常用自动化测试框架——Pytest
一篇文章带你了解Python常用自动化测试框架--Pytest 在之前的文章里我们已经学习了Python自带测试框架UnitTest,但是UnitTest具有一定的局限性 这篇文章里我们来学习第三方框 ...
- UNI-APP之微信小程序转H5
开始 最近有个需求,需要将微信小程序中一些页面和功能改成h5,这次功能开发的时间有点紧,而且重新写一套有点来不及.考虑到微信小程序与uni-app有着一些共通之处,所以打算直接转成uni-app.un ...
- js实现按照首字母排序
<script type="text/javascript"> let obj = [{name:'CA'},{name:'XA'},{name:'CB'},{name ...