问答详情
源自:4-1 转账环境的搭建

报java.lang.IllegalStateException: Failed to load ApplicationContext; at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)

<?
xml version
="1.0" 
encoding
="UTF-8"
?>

<
beans 
xmlns
="http://www.springframework.org/schema/beans"

       
xmlns:
xsi
="http://www.w3.org/2001/XMLSchema-instance"

       
xmlns:
context
="http://www.springframework.org/schema/context"

       
xmlns:
aop
="http://www.springframework.org/schema/aop"

       
xmlns:
tx
="http://www.springframework.org/schema/tx"

         
xsi
:schemaLocation
="http://www.springframework.org/schema/beans

        http://www.springframework.org/schema/beans/spring-beans.xsd

        http://www.springframework.org/schema/context

        http://www.springframework.org/schema/context/spring-context.xsd

        http://www.springframework.org/schema/aop

        http://www.springframework.org/schema/aop/spring-aop.xsd

        http://www.springframework.org/schema/tx

        http://www.springframework.org/schema/spring-tx.xsd "
>


    
<!-- 引入外部的属性文件-->

    
<
context
:property-placeholder 
location
="classpath:jdbc.properties"
/>


    
<!--配置c3p0连接池-->

    
<
bean 
id
="dataSource" 
class
="com.mchange.v2.c3p0.ComboPooledDataSource"
>

        
<
property 
name
="driverClass" 
value
="${jdbc.dreverClass}"
/>

        
<
property 
name
="jdbcUrl" 
value
="${jdbc.url}"
/>

        
<
property 
name
="user" 
value
="${jdbc.username}"
/>

        
<
property 
name
="password" 
value
="${jdbc.password}"
/>

    
</
bean
>


    
<!--配置业务层-->

    
<
bean 
id
="accountService" 
class
="cn.muke.spring.demol.AccountServiceImpl"
>

        
<
property 
name
="accountDao" 
ref
="accountDao"
/>


    
</
bean
>

    
<!--配置DAO的类-->

    
<
bean 
id
="accountDao" 
class
="cn.muke.spring.demol.AccountDaoImpl"
>

        
<
property 
name
="dataSource" 
ref
="dataSource"
/>

    
</
bean
>

</
beans
>

提问者:每个不起舞的日子都是对生命的辜负 2017-08-29 11:51

个回答

  • IT追梦
    2017-08-29 15:07:27

    AccountDaoImpl 这个类你程序里面有吗?