!91 fix: 不配置全局设置时发生 NPE 问题。

Merge pull request !91 from 王帅/main
This commit is contained in:
Michael Yang 2023-06-23 14:04:07 +00:00 committed by Gitee
commit 14e1591f73
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 8 deletions

View File

@ -133,7 +133,9 @@ public class MybatisFlexAutoConfiguration implements InitializingBean {
// 检测 MyBatis 原生配置文件是否存在
checkConfigFileExists();
// 添加 MyBatis-Flex 全局配置
this.properties.getGlobalConfig().applyTo(FlexGlobalConfig.getDefaultConfig());
if (properties.getGlobalConfig() != null) {
properties.getGlobalConfig().applyTo(FlexGlobalConfig.getDefaultConfig());
}
}
private void checkConfigFileExists() {

View File

@ -16,13 +16,13 @@ spring:
mybatis-flex:
mapper-locations:
- classpath*:/mapper/*.xml
global-config:
print-banner: false
key-config:
key-type: generator
value: uuid
configuration:
use-generated-keys: true
# global-config:
# print-banner: false
# key-config:
# key-type: generator
# value: uuid
# configuration:
# use-generated-keys: true
# datasource:
# data-center:
# url: jdbc:mysql://localhost:3306/flex_test