diff --git a/license/keystore/privateKeys.keystore b/license/keystore/privateKeys.keystore deleted file mode 100644 index 295a84d..0000000 Binary files a/license/keystore/privateKeys.keystore and /dev/null differ diff --git a/src/main/java/org/wfc/common/license/controller/LicenseCreatorController.java b/src/main/java/org/wfc/common/license/controller/LicenseCreatorController.java index 5fd3375..c6a2085 100644 --- a/src/main/java/org/wfc/common/license/controller/LicenseCreatorController.java +++ b/src/main/java/org/wfc/common/license/controller/LicenseCreatorController.java @@ -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()); diff --git a/src/main/java/org/wfc/common/license/license/CustomKeyStoreParam.java b/src/main/java/org/wfc/common/license/license/CustomKeyStoreParam.java index a28faf4..7abf962 100644 --- a/src/main/java/org/wfc/common/license/license/CustomKeyStoreParam.java +++ b/src/main/java/org/wfc/common/license/license/CustomKeyStoreParam.java @@ -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); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 74b5348..64f8cae 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -6,6 +6,5 @@ server.shutdown=graceful spring.lifecycle.timeout-per-shutdown-phase=10s #License������� -license.privateKeysPath=/opt/license/keystore/privateKeys.keystore license.licensePath=/opt/license/license.lic