1.控制台报错
2.applicationContext.xml报红
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/example?useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="walletDao" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="person.myj.dao.WalletDao"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>
<bean name="walletService" class="person.myj.service.impl.WalletServiceImpl">
<property name="walletDao" ref="walletDao"/>
</bean>
</beans>
3.原因
排查发现忘记导入依赖了
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.6</version>
</dependency>
总结:
勿粗心大意