Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1e0721ac]

问题一:

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1e0721ac] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@196918e2] will not be managed by Spring

产生原因:没有配置事物控制

解决办法:在启动类中添加@EnableTransactionManagement 和实现类中添加@Transactional 声明事务就可以了,

 

你可能感兴趣的:(springboot)