【发布时间】:2019-06-19 04:40:22
【问题描述】:
我想为我的应用程序设置自定义信任库。我想使用 System.setProperty()。在 tomcat 中设置不是一个选项。
所有的配置似乎都很好,但它不起作用。 我使用带有外部 tomcat 的 Spring boot 2.0.6。
我尝试了不同的地方进行配置,比如在 Bean 的 Postconstruct 中,就在 SpringApplication.run 之前。这是我最近的代码:
static {
System.setProperty("javax.net.debug", "all");
System.setProperty("javax.net.ssl.trustStore", "/opt/grtc8/profiles/appconf/insurance/https-trust.p12");
System.setProperty("javax.net.ssl.trustStorePassword", "xys");
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12");
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(InsuranceCalculatorApplication.class);
}
public static void main(String[] args){
SpringApplication.run(InsuranceCalculatorApplication.class, args);
}
我有一个证书异常,它似乎没有读取文件,或者其他什么。
我使用的是 Tomcat 8.5。
【问题讨论】:
-
您有什么“证书异常”?
标签: java spring spring-boot tomcat truststore