先发一下错误:
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>
|