| | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import javax.sql.DataSource; |
| | | |
| | | import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; |
| | | import org.apache.ibatis.io.VFS; |
| | | import org.apache.ibatis.session.SqlSessionFactory; |
| | | import org.mybatis.spring.SqlSessionFactoryBean; |
| | |
| | | |
| | | /** |
| | | * Mybatis支持*匹配扫描包 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | |
| | | typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); |
| | | VFS.addImplClass(SpringBootVFS.class); |
| | | |
| | | final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); |
| | | // final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); |
| | | final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean(); |
| | | sessionFactory.setDataSource(dataSource); |
| | | sessionFactory.setTypeAliasesPackage(typeAliasesPackage); |
| | | sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); |
| | | sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); |
| | | return sessionFactory.getObject(); |
| | | } |
| | | } |
| | | } |