mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 17:48:25 +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;
|
factoryBuilderPlus = bean;
|
||||||
});
|
});
|
||||||
|
|
||||||
globalConfig.setSqlSessionFactory(getFactory());
|
initAfter(dsWrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MybatisAdapterFlex(BeanWrap dsWrap, Props dsProps) {
|
protected MybatisAdapterFlex(BeanWrap dsWrap, Props dsProps) {
|
||||||
@ -44,6 +44,16 @@ public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
|||||||
dsWrap.context().getBeanAsync(FlexSqlSessionFactoryBuilder.class, bean -> {
|
dsWrap.context().getBeanAsync(FlexSqlSessionFactoryBuilder.class, bean -> {
|
||||||
factoryBuilderPlus = bean;
|
factoryBuilderPlus = bean;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initAfter(dsWrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initAfter(BeanWrap dsWrap) {
|
||||||
|
globalConfig.setSqlSessionFactory(getFactory());
|
||||||
|
|
||||||
|
if (dsWrap.typed()) {
|
||||||
|
FlexGlobalConfig.setDefaultConfig(globalConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,8 +63,6 @@ public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initConfiguration(Environment environment) {
|
protected void initConfiguration(Environment environment) {
|
||||||
|
|
||||||
|
|
||||||
//for configuration section
|
//for configuration section
|
||||||
config = new FlexConfiguration(environment);
|
config = new FlexConfiguration(environment);
|
||||||
|
|
||||||
@ -74,7 +82,8 @@ public class MybatisAdapterFlex extends MybatisAdapterDefault {
|
|||||||
Utils.injectProperties(globalConfig, globalProps);
|
Utils.injectProperties(globalConfig, globalProps);
|
||||||
}
|
}
|
||||||
globalConfig.setConfiguration(config);
|
globalConfig.setConfiguration(config);
|
||||||
FlexGlobalConfig.setConfig(environment.getId(), globalConfig);
|
|
||||||
|
FlexGlobalConfig.setConfig(environment.getId(), globalConfig, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user