feat: privateKey取resource的
This commit is contained in:
Binary file not shown.
@@ -34,8 +34,8 @@ public class LicenseCreatorController {
|
||||
@Value("${license.licensePath}")
|
||||
private String licensePath;
|
||||
|
||||
@Value("${license.privateKeysPath}")
|
||||
private String privateKeysPath;
|
||||
// @Value("${license.privateKeysPath}")
|
||||
// private String privateKeysPath;
|
||||
|
||||
/**
|
||||
* 获取服务器硬件信息
|
||||
@@ -113,7 +113,8 @@ public class LicenseCreatorController {
|
||||
}
|
||||
// 相对路径resources资源目录
|
||||
// String resourcePath = getClass().getClassLoader().getResource("").getPath();
|
||||
param.setPrivateKeysStorePath(privateKeysPath);
|
||||
// param.setPrivateKeysStorePath(privateKeysPath);
|
||||
param.setPrivateKeysStorePath("privateKeys.keystore");
|
||||
// param.setPrivateKeysStorePath("D:\\projects\\testdir\\spring-boot2-license\\cloud-license-serve\\target\\classes\\privateCerts.keystore");
|
||||
param.setIssuedTime(new Date());
|
||||
param.setExpiryTime(genParam.getExpiryTime());
|
||||
|
||||
@@ -2,7 +2,9 @@ package org.wfc.common.license.license;
|
||||
|
||||
import de.schlichtherle.license.AbstractKeyStoreParam;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 自定义KeyStoreParam,用于将公私钥存储文件存放到其他磁盘位置而不是项目中
|
||||
@@ -50,7 +52,8 @@ public class CustomKeyStoreParam extends AbstractKeyStoreParam {
|
||||
*/
|
||||
@Override
|
||||
public InputStream getStream() throws IOException {
|
||||
final InputStream in = new FileInputStream(new File(storePath));
|
||||
// final InputStream in = new FileInputStream(new File(storePath));
|
||||
InputStream in = this.getClass().getClassLoader().getResourceAsStream(storePath);
|
||||
if (null == in) {
|
||||
throw new FileNotFoundException(storePath);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,5 @@ server.shutdown=graceful
|
||||
spring.lifecycle.timeout-per-shutdown-phase=10s
|
||||
|
||||
#License<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
license.privateKeysPath=/opt/license/keystore/privateKeys.keystore
|
||||
license.licensePath=/opt/license/license.lic
|
||||
|
||||
|
||||
Reference in New Issue
Block a user