代码拉取完成,页面将自动刷新
http://82.157.162.230:8080/#/license 生成文件代码调试发现申请时间2037年
error:
long applyTime = readLong(inputStream);
if (applyTime > System.currentTimeMillis()) {
throw new LicenseException("invalid license");
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
亲测没问题
大哥,有点迷茫。生成:
maven:
<dependency>
<groupId>org.smartboot.license</groupId>
<artifactId>license-client</artifactId>
<version>2.0</version>
</dependency>
代码:
@Component
public class LicenseTest implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
License license = new License(entity -> {
System.err.println("过期啦");
System.exit(-1);
}, 3000);
try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("License.shield")) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
int size;
while ((size = inputStream.read(bytes)) > 0) {
byteArrayOutputStream.write(bytes, 0, size);
}
LicenseEntity entity = license.loadLicense(byteArrayOutputStream.toByteArray());
System.err.println(IoUtils.toString(entity.getData()));
// properties.load(new ByteArrayInputStream(entity.getData()));
// System.out.println(properties);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
日期:
是哪里操作姿势不对吗
源码client测试正常,原因是maven打包resources资源的时候对这个文件变更了,使用插件后正常:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<!-- 不过滤文件扩展名-->
<nonFilteredFileExtensions>
<nonFilteredFileExtension>lic</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
登录 后才可以发表评论