the following error should be related to the injection of the data source! But why can it be solved by introducing spring-jdbc as a jar package?
spring-jdbcjar:():
: Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name "sqlSessionFactory" defined in file
[C:\Users\123\IdeaProjects\SpringDemo\target\seckill\WEB-INF\classes\spring\spring-dao.xml]:
Error setting property values;
nested exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException:
Property "dataSource" threw exception;
nested exception is java.lang.NoClassDefFoundError:
org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy
the configuration of the data source in spring-dao.xml is attached as follows:
<!--2.-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<!---->
<property name="driverClass" value="${driver}" />
<!-- urluserpassword -->
<property name="jdbcUrl" value="${url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${password}" />
<!--c3p0-->
<property name="maxPoolSize" value="30"/>
<property name="minPoolSize" value="10"/>
<!--commit-->
<property name="autoCommitOnClose" value="false"/>
<!---->
<property name="checkoutTimeout" value="1000"/>
<!---->
<property name="acquireRetryAttempts" value="2"/>
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!--sql:mapperxml-->
<property name="mapperLocations" value="classpath:com/imooc/mappers/*.xml"/>
</bean>