SpringBoot多数据源中使用mybatis-plus出现I
在springboot项目中应为配置了多数据源,然后引入mybatis-plus的配置,发现并没有生效,查询的时候使用selectById这种内置方法直接报 Invalid bound statement (not found) ,通过查找mybatis-plus官方文档得知,不能使用原生的 SqlSessionFactory,正好项目里面配置的是原生的

image
改成使用MybatisSqlSessionFactoryBean来获取就可以了

image
然后springboot启动日志成功打印出mybatis-plus的banner

image
文档如下 https://mp.baomidou.com/guide/faq.html#%E5%87%BA%E7%8E%B0-invalid-bound-statement-not-found-%E5%BC%82%E5%B8%B8:

image
本文标题:SpringBoot多数据源中使用mybatis-plus出现I
本文链接:https://www.haomeiwen.com/subject/fpaxfhtx.html
网友评论