<properties>
<!-- Apache HttpClient -->
<httpclient>4.5.5</httpclient>
<!-- License -->
<truelicense>1.33</truelicense>
</properties>
</dependencies>下:
<!-- Apache HttpClient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient}</version>
</dependency>
<!-- Jackson对自动解析JSON和XML格式的支持 -->
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<!-- License -->
<dependency>
<groupId>de.schlichtherle.truelicense</groupId>
<artifactId>truelicense-core</artifactId>
<version>${truelicense}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>
最后:
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.tld</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
@ServletComponentScan
@ComponentScan(basePackageClasses = {BcdFlightApplication.class, LicenseCheckListener.class})
@PropertySource({"license-config.properties"}) //加载额外的配置
public class BcdFlightApplication extends SpringBootServletInitializer { ... }
/**
* 添加拦截器
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LicenseCheckInterceptor()).addPathPatterns("/flight/hlFlyPlan/**");
registry.addInterceptor(new LicenseCheckInterceptor()).addPathPatterns("/flight/hlFlyDemand/**");
}
windows执行(获取IP,mac,CPU,主板信息.bat)文件,获取认证所需相关信息。
#生成命令
keytool -genkeypair -keysize 1024 -validity 3650 -alias "privateKey" -keystore "privateKeys.keystore" -storepass "public_password1234" -keypass "private_password1234" -dname "CN=localhost, OU=localhost, O=localhost, L=SH, ST=SH, C=CN"
#导出命令
keytool -exportcert -alias "privateKey" -keystore "privateKeys.keystore" -storepass "public_password1234" -file "certfile.cer"
#导入命令
keytool -import -alias "publicCert" -file "certfile.cer" -keystore "publicCerts.keystore" -storepass "public_password1234"
windows:将privateKeys.keystore,publicCerts.keystore导入C:/layman/目录下
Linux:将privateKeys.keystore,publicCerts.keystore导入/layman/目录下
windows:将license.lic导入C:/layman/目录下
Linux:将license.lic导入/layman/目录下