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