錯誤:Exception sending context initialized event to listener instance of class org.springframework.web

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'archCompanyAction':
Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field:
private com.honghailt.accountant.sys.service.ArchCompanyServiceImpl
com.honghailt.accountant.sys.action.ArchCompanyAction.service;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'archCompanyServiceImpl': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private com.honghailt.accountant.sys.dao.ArchCompanyDao
com.honghailt.accountant.sys.service.ArchCompanyServiceImpl.dao;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [com.honghailt.accountant.sys.dao.ArchCompanyDao]
found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

解決方案:web

mybatis 對應的xml中 返回類型的bean沒有關聯上.須要在spring配置文件關聯上,以下spring

<tx:annotation-driven transaction-manager="transactionManager1"/>

    <bean id="sqlSessionFactory1" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource1"/>
        <property name="typeAliasesPackage"
                  value="com.honghailt.accountant.bo.*,com.honghailt.accountant.sys.bo"/>
        <property name="configLocation" value="classpath:mybatis-config.xml"/>
    </bean>

    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage"
                  value="com.honghailt.accountant.dao.ds1,com.honghailt.accountant.sys.dao"/>
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory1"/>
    </bean>
相關文章
相關標籤/搜索