我正在尝试将我的 http4 证书配置从 RouteBuilder 类移到 application.yml 文件中。我的代码与此页面上“为 HTTP 客户端设置 SSL - 组件的编程配置”下的 Java 示例完全相同:( https://camel.apache.org/http4.html#HTTP4-UsingtheJSSEConfigurationUtility )。但是,网站上没有 yml 示例,只有我目前拥有的 Java 解决方案和 Spring DSL 解决方案。有人知道如何将 Java 代码翻译成 yml 吗?
@Configuration
public class configureHttps4Certificate extends RouteBuilder {
@Override
public void configure() throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource("pathToResource");
ksp.setPassword("password");
TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(ksp);
SSLContextParameters scp = new SSLContextParameters();
scp.setTrustManagers(tmp);
HttpComponent httpComponent = getContext().getComponent("https4", HttpComponent.class);
httpComponent.setSslContextParameters(scp);
}
}