mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
This commit is contained in:
parent
1757d9fb98
commit
eaf0635f34
@ -50,8 +50,6 @@ public class MybatisFlexConfig {
|
|||||||
protected final Properties properties = new Properties();
|
protected final Properties properties = new Properties();
|
||||||
|
|
||||||
public MybatisFlexConfig(Filer filer) {
|
public MybatisFlexConfig(Filer filer) {
|
||||||
// 先从 resources 目录读取 mybatis-flex.config 配置文件
|
|
||||||
loadConfigFromResource();
|
|
||||||
try {
|
try {
|
||||||
//target/classes/
|
//target/classes/
|
||||||
FileObject resource = filer.createResource(StandardLocation.CLASS_OUTPUT, "", "mybatis-flex");
|
FileObject resource = filer.createResource(StandardLocation.CLASS_OUTPUT, "", "mybatis-flex");
|
||||||
@ -99,20 +97,6 @@ public class MybatisFlexConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConfigFromResource() {
|
|
||||||
Properties resourceProp = new Properties();
|
|
||||||
try (InputStream resourceStream = MybatisFlexConfig.class.getClassLoader().getResourceAsStream(APT_FILE_NAME)) {
|
|
||||||
if (resourceStream == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
resourceProp.load(resourceStream);
|
|
||||||
if (resourceProp != null && !resourceProp.isEmpty()) {
|
|
||||||
properties.putAll(resourceProp);
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String get(ConfigurationKey key) {
|
public String get(ConfigurationKey key) {
|
||||||
return properties.getProperty(key.getConfigKey(), key.getDefaultValue());
|
return properties.getProperty(key.getConfigKey(), key.getDefaultValue());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user