Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.service.CpoeBasicPharmAndClinicService': Cannot resolve reference to bean 'cpoeBasicPharmAndClinicService' while setting bean property 'ref'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cpoeBasicPharmAndClinicService' defined in class path resource [META-INF/cpoe/basic/cpoe-basic-service.spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.impl.CpoeBasicPharmAndClinicManagerImpl' to required type 'com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.CpoeBasicPharmAndClinicManager' for property 'cpoeBasicPharmAndClinicManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.impl.CpoeBasicPharmAndClinicManagerImpl] to required type [com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.CpoeBasicPharmAndClinicManager] for property 'cpoeBasicPharmAndClinicManager': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)
at ServerTest.main(ServerTest.java:14)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cpoeBasicPharmAndClinicService' defined in class path resource [META-INF/cpoe/basic/cpoe-basic-service.spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.impl.CpoeBasicPharmAndClinicManagerImpl' to required type 'com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.CpoeBasicPharmAndClinicManager' for property 'cpoeBasicPharmAndClinicManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.impl.CpoeBasicPharmAndClinicManagerImpl] to required type [com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.CpoeBasicPharmAndClinicManager] for property 'cpoeBasicPharmAndClinicManager': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 15 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.impl.CpoeBasicPharmAndClinicManagerImpl' to required type 'com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.CpoeBasicPharmAndClinicManager' for property 'cpoeBasicPharmAndClinicManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.impl.CpoeBasicPharmAndClinicManagerImpl] to required type [com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.CpoeBasicPharmAndClinicManager] for property 'cpoeBasicPharmAndClinicManager': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
... 21 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.impl.CpoeBasicPharmAndClinicManagerImpl] to required type [com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.manager.CpoeBasicPharmAndClinicManager] for property 'cpoeBasicPharmAndClinicManager': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
... 27 more
bean 的注入有问题
能不能说的具体点,简单的例子
com.th.supcom.emr.cpoe.business.basicmanager.pharmclinic.service.CpoeBasicPharmAndClinicService 创建失败 检查一下bean的配置
把配置文件和代码都贴出来。
Cannot resolve reference to bean 'cpoeBasicPharmAndClinicService' while setting bean property 'ref';
明显是配置文件配错了。
ref处的bean有没有创建
如果你使用了@Service在Java文件中,那么注意下你某个service使用的时候是不是没有指定名字