You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
因@ConditionalOnSingleCandidate(DataSource.class) MybatisPlusAutoConfiguration 在多数据下不会生效,但是我非常喜欢MybatisPlusAutoConfiguration的功能,所以我在项目中分别创建了2个MybatisConfig 配置类继承MybatisPlusAutoConfiguration
但是这样带来一个问题:两个SqlSessionFactory使用的是同一个GlobalConfig对象,都是从MybatisPlusProperties中获取的,通过GlobalConfig获取SqlSessionFactory只会得到最后创建的SqlSessionFactory
因而导致某些操作出现错误:Mapped Statements collection does not contain value
建议:全局缓存GlobalConfig并不是一个好的设计,有悖面向对象的思想,个人浅见:既然已经自定义了MybatisConfiguration,将MybatisConfiguration和GlobalConfig合并
参考资料
No response
The text was updated successfully, but these errors were encountered:
确认
功能改进
因@ConditionalOnSingleCandidate(DataSource.class) MybatisPlusAutoConfiguration 在多数据下不会生效,但是我非常喜欢MybatisPlusAutoConfiguration的功能,所以我在项目中分别创建了2个MybatisConfig 配置类继承MybatisPlusAutoConfiguration
但是这样带来一个问题:两个SqlSessionFactory使用的是同一个GlobalConfig对象,都是从MybatisPlusProperties中获取的,通过GlobalConfig获取SqlSessionFactory只会得到最后创建的SqlSessionFactory
因而导致某些操作出现错误:Mapped Statements collection does not contain value
建议:全局缓存GlobalConfig并不是一个好的设计,有悖面向对象的思想,个人浅见:既然已经自定义了MybatisConfiguration,将MybatisConfiguration和GlobalConfig合并
参考资料
No response
The text was updated successfully, but these errors were encountered: