org.springframework.beans.factory.BeanCreationException: Error creating bean wit

论坛 期权论坛 脚本     
已经匿名di用户   2022-5-29 19:21   1431   0

先发一下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tx' defined in file [E:\java\bank_system1\out\artifacts\bank_system1_war_exploded\WEB-INF\classes\applicationContext-tx.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found

日志信息应该要从上往下看错误信息:首先是name为tx的对象创建失败,就是说我的xml中的 id为tx的这个出现了问题,在检查第二个问题,发现属性 dataSource这有问题,检查后发现了问题

原来的xml文件:


    <bean id="tx" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" value="dataSource"></property>
    </bean>

修改后:

    <bean id="tx" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"></property>
    </bean>



分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP