|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
|
import model.DataSourceModel; |
|
|
|
|
import org.apache.commons.io.FileUtils; |
|
|
|
|
import org.apache.ibatis.logging.log4j2.Log4j2Impl; |
|
|
|
|
import org.apache.ibatis.session.Configuration; |
|
|
|
|
import org.mybatis.spring.SqlSessionFactoryBean; |
|
|
|
|
import org.mybatis.spring.SqlSessionTemplate; |
|
|
|
@ -40,7 +41,10 @@ public class MyBatisConfig extends InitConfig { |
|
|
|
|
dataSource.setPassword(password); |
|
|
|
|
String url = ""; |
|
|
|
|
switch (type) { |
|
|
|
|
case mysql5: |
|
|
|
|
case mysql55: |
|
|
|
|
case mysql57: |
|
|
|
|
case mysql8: |
|
|
|
|
url = type.getUrl(dbHost, dbPort, dbName); |
|
|
|
|
dataSource.setUrl(url); |
|
|
|
|
dataSource.setDriverClassName(type.getDriver().getName()); |
|
|
|
@ -76,6 +80,7 @@ public class MyBatisConfig extends InitConfig { |
|
|
|
|
beanFactory.registerSingleton(dataSourceModel.getTransactionManagerBean(), transactionManager); |
|
|
|
|
|
|
|
|
|
Configuration configuration = new Configuration(); |
|
|
|
|
configuration.setLogImpl(Log4j2Impl.class); |
|
|
|
|
PathMatchingResourcePatternResolver resolver=new PathMatchingResourcePatternResolver(); |
|
|
|
|
try { |
|
|
|
|
LOG.info("Mapper匹配规则"+dataSourceModel.getMapperXmlPath()); |
|
|
|
|