我有一个Mavenized项目(web应用程序),我使用SpringBoot打包并运行它。我将其打包为war,然后使用spring-boot:run maven goal启动它。应用程序调用少数需要证书的第三方供应商RESTful API。我有来自供应商的cacert文件;对于我的本地主机,我将证书文件保存在我的文件系统中,并在SpringBoot启动期间使用javax.net.ssl.trustStore命令行参数引用它,例如:javax.net.ssl.trustStore=<path to cacert file on my file system>我现在决定将证书文件保存在我的类路径中(因此保存在src/main/resources下的某个文件夹中)。我希望SpringBoot在启动时加载此资源,并使用javax.net.ssl.trustStore系统属性引用它。有没有人可以帮助我怎么做?
发布于 2016-11-08 11:38:51
下面是ssl属性列表(将这些属性添加到application.properties文件中):
server.ssl.ciphers= # Supported SSL ciphers.
server.ssl.client-auth= # Whether client authentication is wanted ("want") or needed ("need"). Requires a trust store.
server.ssl.enabled= # Enable SSL support.
server.ssl.enabled-protocols= # Enabled SSL protocols.
server.ssl.key-alias= # Alias that identifies the key in the key store.
server.ssl.key-password= # Password used to access the key in the key store.
server.ssl.key-store= # Path to the key store that holds the SSL certificate (typically a jks file).
server.ssl.key-store-password= # Password used to access the key store.
server.ssl.key-store-provider= # Provider for the key store.
server.ssl.key-store-type= # Type of the key store.
server.ssl.protocol=TLS # SSL protocol to use.
server.ssl.trust-store= # Trust store that holds SSL certificates.
server.ssl.trust-store-password= # Password used to access the trust store.
server.ssl.trust-store-provider= # Provider for the trust store.
server.ssl.trust-store-type= # Type of the trust store.希望对您有所帮助,参考资料:http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
https://stackoverflow.com/questions/40472805
复制相似问题