Bean named '...' is expected to be of type [...] but was actually of type [com.sun.proxy.$Pr
Posted Stay Hungry, Stay Foolish
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Bean named '...' is expected to be of type [...] but was actually of type [com.sun.proxy.$Pr相关的知识,希望对你有一定的参考价值。
报错
三月 07, 2017 8:09:52 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@41cf53f9: startup date [Tue Mar 07 20:09:52 CST 2017]; root of context hierarchy
三月 07, 2017 8:09:52 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [beans.xml]
Exception in thread "main" org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named \'helloface\' is expected to be of type [com.ij34.service.Hello] but was actually of type [com.sun.proxy.$Proxy7]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:378)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1082)
at com.ij34.bean.test.main(test.java:12)
package com.ij34.aspect; import org.aspectj.lang.annotation.*; @Aspect public class Autoaspect { @Before("execution(* com.ij34.service.*.*(..))") public void authority() { System.out.println("模拟执行权限检查"); } }
解决方法:去掉 .serivce
因为这路径还没有把com.ij34.inferfaces包含在内
或者把<aop:aspectj-autoproxy/> 修改成<aop:aspectj-autoproxy proxy-target-class="true"/>
以上是关于Bean named '...' is expected to be of type [...] but was actually of type [com.sun.proxy.$Pr的主要内容,如果未能解决你的问题,请参考以下文章
Error creating bean with name 'transactionManager'
No bean named 'sqlSessionFactory' is defined
异常记录---Error creating bean with name 'sqlSessionFactory'
No bean named 'transactionManager' is defined
Annotation-specified bean name 'userDaoImpl' for bean class [***] conflicts with existing, n