MyBatis spring in a multi tenant application
问题 Hi needed some help in using MyBatis spring in a multi tenant application ... Is it possible ? Especially since i do not see how "MapperScannerConfigurer" can be configured with sqlSessionFactory at run time. 回答1: Spring has AbstractRoutingDataSource to take care of this problem http://spring.io/blog/2007/01/23/dynamic-datasource-routing/ 回答2: It is possible to create tenant scoped datasource using factory and wire it to SqlSessionFactory which is used by mappers generated by mybatis-spring.