feat: processor 读取 mybatis-flex.properties 文件添加使用 ClassLoader 读取

This commit is contained in:
XiaoLin 2023-05-17 01:00:10 +08:00
parent d454ff78d0
commit f1e3f8df22

View File

@ -25,8 +25,8 @@ import java.util.Properties;
class MyBatisFlexProps {
protected Properties properties = new Properties();
private static final String DEFAULT_ENCODING = "UTF-8";
protected Properties properties = new Properties();
public MyBatisFlexProps(Filer filer) {
InputStream inputStream = null;
@ -37,6 +37,8 @@ class MyBatisFlexProps {
File propertiesFile = new File(propertiesFileObject.toUri());
if (propertiesFile.exists()) {
inputStream = propertiesFileObject.openInputStream();
} else if (getClass().getClassLoader().getResource("mybatis-flex.properties") != null) {
inputStream = getClass().getClassLoader().getResourceAsStream("mybatis-flex.properties");
} else {
File pomXmlFile = new File(propertiesFile.getParentFile().getParentFile().getParentFile(), "pom.xml");
if (pomXmlFile.exists()) {