• 错误:Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener


    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)}

    解决方案:

    mybatis 对应的xml中 返回类型的bean没有关联上.需要在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>
  • 相关阅读:
    ASP.NET Core 中的管道机制
    常见的 HttpModule
    IIS+Asp.Net Mvc必须知道的事(解决启动/重启/自动回收站点后第一次访问慢问题)
    ASP.NET三剑客 HttpApplication HttpModule HttpHandler 解析
    Js国际化
    MethodImplOptions
    Java守护线程普通线程的例子
    Java启动新线程的几种方式(Runnable、Callable、CompletableFuture)
    Tomcat源码分析(3)-容器Container整体架构
    Tomcat源码分析(2)-连接器Connector整体架构
  • 原文地址:https://www.cnblogs.com/w8104254/p/4114991.html
Copyright © 2020-2023  润新知