0

I'm trying to move my http4 certificate configuration away from RouteBuilder class and to application.yml file. My code is exactly like the Java example on this page under the "Setting up SSL for HTTP Client - Programmatic Configuration of the Component": (https://camel.apache.org/http4.html#HTTP4-UsingtheJSSEConfigurationUtility). However, on the website there is no yml example, only the Java solution that I currently have and Spring DSL solution. Does anybody know how to translate the Java code to 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);

    }
}

1 Answers1

0

If you use SpringBoot you can easily create Java configuration classes that automatically import values from property or YAML files just by using one annotation.

@ConfigurationProperties("app.config")
public class MyConfiguration  

Check out this section of the SpringBoot documentation that describes this mechanism.

burki
  • 6,741
  • 1
  • 15
  • 31
  • Thanks for your suggestion. However, I already have something similar, and I would want to not depend on java class configuration, but rather to have the entire configuration in the application.yml file which is automatically loaded and configured during runtime. The only thing missing from it is the SSL certificate configuration part. – Dule Cux May 15 '19 at 11:46