没有添加事务管理的依赖
java.lang.NoClassDefFoundError: org/springframework/dao/support/DaoSupport:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
连接池注入错误
Caused by: 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
没有配置jdbc依赖
NoClassDefFoundError: org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
配置文件路径写错
expected at least 1 bean which qualifies as autowire candidate for this depe
@ContextConfiguration(locations = "classpath*:spring/applicationContext*.xml")
这里写错了
测试类中加载不到配置文件
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
路径正确,idea中将resources目录标记为ResourcesBoot导致,修改为TestResourcesBoot后正常
连接池属性注入失败
service层注入也加载了properties文件,<value>classpath:resources/*.properties</value>这一段配置与placeholder冲突,修改为
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:resources/*.properties</value>
</list>
</property>
</bean>