[manager]fix不同系统开发和部署环境读取配置文件

This commit is contained in:
tomsun28
2022-02-10 13:50:24 +08:00
parent 1e5f72d2d9
commit 8ffde31707

View File

@@ -123,11 +123,11 @@ public class AppServiceImpl implements AppService, CommandLineRunner {
public void run(String... args) throws Exception {
// 读取app定义配置加载到内存中 define/app/*.yml
Yaml yaml = new Yaml();
String classpath = this.getClass().getResource(File.separator).getPath();
String classpath = this.getClass().getClassLoader().getResource("").getPath();
String defineAppPath = classpath + File.separator + "define" + File.separator + "app";
File directory = new File(defineAppPath);
if (!directory.exists() || directory.listFiles() == null) {
classpath = this.getClass().getResource("").getPath();
classpath = this.getClass().getResource(File.separator).getPath();
defineAppPath = classpath + File.separator + "define" + File.separator + "app";
directory = new File(defineAppPath);
if (!directory.exists() || directory.listFiles() == null) {