Spring注入期间不满意的依赖异常

时间:2014-08-16 02:23:44

标签: spring

我使用构造函数参数使用Spring注入时出现此错误:

org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'testIdCreator': Unsatisfied dependency
expressed through constructor argument with index 0 of type 
[IdCreatorDao]: : No matching bean of type [com.dao.IdCreatorDao

Bean定义:

<bean id="testIdCreator" class="com.utils.TestIdCreator">
    <constructor-arg ref="mydDao"/>
</bean>
<bean id="mydDao" class="com.dao.idCreatorDAOImpl">
    <constructor-arg ref="somedatasource" />
    <constructor-arg value="${somedatasource.schema}" />
</bean>

Bean使用:

public class TestIdCreator{
     private final IdCreatorDao idDao;


    @Inject
    public TestIdCreator(IdCreatorDao idDao) {
        this.idDao= idDao;
    }
}

0 个答案:

没有答案