类org.springframework.boot.system.ApplicationHome源码实例Demo

下面列出了怎么用org.springframework.boot.system.ApplicationHome的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: djl-demo   文件: ShellSpawner.java
static InteractiveShell createShell(String engine) {
    InteractiveShell shell = new InteractiveShell();
    ApplicationHome home = new ApplicationHome(BlockRunnerController.class);
    Path targetDir = home.getDir().toPath().resolve("djl");
    extractJars(targetDir);
    shell.addDependencyDir(targetDir.resolve("basic"));
    File[] engineFiles = targetDir.resolve("engines").toFile().listFiles();
    if (engineFiles == null) {
        throw new IllegalStateException("Cannot find Engine files");
    }
    for (File file : engineFiles) {
        if (file.getName().startsWith(engine)) {
            shell.addDependency(file.toPath());
        }
    }
    return shell;
}
 
private File getLogDir() {
    if (StringUtils.hasLength(this.jtaProperties.getLogDir())) {
        return new File(this.jtaProperties.getLogDir());
    }
    File home = new ApplicationHome().getDir();
    return new File(home, "transaction-logs");
}
 
@Test
public void narayanaPropertiesInitializerShouldUseDefaultLogDir() {
    this.configuration.narayanaPropertiesInitializer(this.mockNarayanaProperties);
    File applicationHomeDir = new ApplicationHome().getDir();
    File expectedLogDir = new File(applicationHomeDir, "transaction-logs");
    verify(this.mockNarayanaProperties).setLogDir(expectedLogDir.getAbsolutePath());
}
 
源代码4 项目: das   文件: ResourceUtil.java
public String getClasspath() {
    ApplicationHome h = new ApplicationHome(DbUtil.class);
    File jarF = h.getSource();
    return jarF.getParentFile().toString();
}
 
源代码5 项目: Jpom   文件: JpomManifest.java
/**
 * 获取当前运行的路径
 *
 * @return jar 或者classPath
 */
public static File getRunPath() {
    ApplicationHome home = new ApplicationHome(JpomApplication.getAppClass());
    String path = (home.getSource() == null ? "" : home.getSource().getAbsolutePath());
    return FileUtil.file(path);
}
 
 类所在包
 类方法
 同包方法