mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 09:08:24 +08:00
feat: mybatis-flex-processor 读取 mybatis-flex.properties 添加兜底策略
This commit is contained in:
parent
0149830eed
commit
abb6f6d9a7
@ -16,6 +16,8 @@
|
||||
|
||||
package com.mybatisflex.processor.config;
|
||||
|
||||
import com.mybatisflex.processor.util.FileUtil;
|
||||
|
||||
import javax.annotation.processing.Filer;
|
||||
import javax.tools.FileObject;
|
||||
import javax.tools.StandardLocation;
|
||||
@ -67,6 +69,15 @@ public class MybatisFlexConfig {
|
||||
inputStream = Files.newInputStream(propertiesFile.toPath());
|
||||
}
|
||||
|
||||
// 兜底,如果还是没找到,就找项目根目录下的 mybatis-flex.properties
|
||||
if (inputStream == null) {
|
||||
final String projectRootPath = FileUtil.getProjectRootPath(propertiesFileObject.toUri().getPath());
|
||||
final File filePath = new File(projectRootPath, MYBATIS_FLEX);
|
||||
if (filePath.exists()) {
|
||||
inputStream = Files.newInputStream(filePath.toPath());
|
||||
}
|
||||
}
|
||||
|
||||
if (inputStream != null) {
|
||||
try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) {
|
||||
properties.load(reader);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user