|
@@ -1,15 +1,8 @@
|
|
|
package com.ruoyi.framework.config;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
|
|
-import com.ruoyi.common.utils.StringUtils;
|
|
|
-import org.apache.ibatis.io.VFS;
|
|
|
-import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
-import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
-import org.springframework.core.io.DefaultResourceLoader;
|
|
|
import org.springframework.core.io.Resource;
|
|
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
|
|
import org.springframework.core.io.support.ResourcePatternResolver;
|
|
@@ -18,7 +11,6 @@ import org.springframework.core.type.classreading.MetadataReader;
|
|
|
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
|
|
import org.springframework.util.ClassUtils;
|
|
|
|
|
|
-import javax.sql.DataSource;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
@@ -114,20 +106,20 @@ public class MyBatisConfig
|
|
|
return resources.toArray(new Resource[resources.size()]);
|
|
|
}
|
|
|
|
|
|
- @Bean
|
|
|
- public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
|
|
|
- {
|
|
|
- String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
|
|
|
- String mapperLocations = env.getProperty("mybatis.mapperLocations");
|
|
|
- String configLocation = env.getProperty("mybatis.configLocation");
|
|
|
- typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
|
|
|
- VFS.addImplClass(SpringBootVFS.class);
|
|
|
-
|
|
|
- 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();
|
|
|
- }
|
|
|
+// @Bean
|
|
|
+// public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
|
|
|
+// {
|
|
|
+// String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
|
|
|
+// String mapperLocations = env.getProperty("mybatis.mapperLocations");
|
|
|
+// String configLocation = env.getProperty("mybatis.configLocation");
|
|
|
+// typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
|
|
|
+// VFS.addImplClass(SpringBootVFS.class);
|
|
|
+//
|
|
|
+// 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();
|
|
|
+// }
|
|
|
}
|