mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-06 16:48:24 +08:00
调整 MybatisAdapterFlex 初始化时,绑定 globalConfig::sqlSessionFactory
This commit is contained in:
parent
2a841b5f11
commit
7da9aaaa63
@ -33,7 +33,7 @@ public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
||||
factoryBuilderPlus = bean;
|
||||
});
|
||||
|
||||
globalConfig.setSqlSessionFactory(getFactory());
|
||||
initAfter(dsWrap);
|
||||
}
|
||||
|
||||
protected MybatisAdapterFlex(BeanWrap dsWrap, Props dsProps) {
|
||||
@ -44,6 +44,16 @@ public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
||||
dsWrap.context().getBeanAsync(FlexSqlSessionFactoryBuilder.class, bean -> {
|
||||
factoryBuilderPlus = bean;
|
||||
});
|
||||
|
||||
initAfter(dsWrap);
|
||||
}
|
||||
|
||||
protected void initAfter(BeanWrap dsWrap) {
|
||||
globalConfig.setSqlSessionFactory(getFactory());
|
||||
|
||||
if (dsWrap.typed()) {
|
||||
FlexGlobalConfig.setDefaultConfig(globalConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,8 +63,6 @@ public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
||||
|
||||
@Override
|
||||
protected void initConfiguration(Environment environment) {
|
||||
|
||||
|
||||
//for configuration section
|
||||
config = new FlexConfiguration(environment);
|
||||
|
||||
@ -74,7 +82,8 @@ public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
||||
Utils.injectProperties(globalConfig, globalProps);
|
||||
}
|
||||
globalConfig.setConfiguration(config);
|
||||
FlexGlobalConfig.setConfig(environment.getId(), globalConfig);
|
||||
|
||||
FlexGlobalConfig.setConfig(environment.getId(), globalConfig, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user