JDBC Connection [org.apache.commons.dbcp.PoolableConnection@47db5fa5] will not be managed by Spring DEBUG [main] - ==> Preparing: select * from user where id = ?

图片说明

JDBC Connection [org.apache.commons.dbcp.PoolableConnection@47db5fa5] will not be managed by Spring

DEBUG [main] - ==> Preparing: select * from user where id = ?

DEBUG [main] - ==> Parameters: 1(Integer)

DEBUG [main] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7d286fb6]

DEBUG [main] - Returning JDBC Connection to DataSource

spring和mybatis的整合

从数据库拿不到数据

MyUser auser = userDao.selectUserById(1);
        System.out.println("名字" +auser.getname());
System.out.println("============================");

拿id为i的数据(这个数据存在,),就不会输出

可以向数据库中存入信息,但是不能拿出来

提示说的很明白,你引用的数据库驱动包中没有com.mysql.jdbc.Driver,新的包中驱动类是com.mysql.cj.jdbc.Driver,所以把你配置中的com.mysql.jdbc.Driver改成com.mysql.cj.jdbc.Driver就好了。

https://blog.csdn.net/iteye_2935/article/details/82583280